Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const numParse = crm.Format.fixedLocale(val, 2);
switch (type) { // eslint-disable-line
case 'days':
return string.substitute(resource.daysText, {
val: numParse,
});
case 'weeks':
return string.substitute(resource.weeksText, {
val: numParse,
});
case 'months':
return string.substitute(resource.monthsText, {
val: numParse,
});
case 'years':
return string.substitute(resource.yearsText, {
val: numParse,
});
}
return rawValue;
},
}));
string.substitute(this.weeklyEveryAfterCompletionSummary, textOptions);
case 4:
// monthly on day
return (textOptions[0] <= 1) ?
string.substitute(this.monthlySummary, textOptions) :
string.substitute(this.monthlyEverySummary, textOptions);
case 5:
// monthly on day ordinal
return (textOptions[0] <= 1) ?
string.substitute(this.monthlyOrdSummary, textOptions) :
string.substitute(this.monthlyEveryOrdSummary, textOptions);
case 6:
// monthly after completion
return (textOptions[0] <= 1) ?
string.substitute(this.monthlyAfterCompletionSummary, textOptions) :
string.substitute(this.monthlyEveryAfterCompletionSummary, textOptions);
case 7:
// yearly on day of the month
return (textOptions[0] <= 1) ?
string.substitute(this.yearlySummary, textOptions) :
string.substitute(this.yearlyEverySummary, textOptions);
case 8:
// yearly on day ordinal
return (textOptions[0] <= 1) ?
string.substitute(this.yearlyOrdSummary, textOptions) :
string.substitute(this.yearlyEveryOrdSummary, textOptions);
case 9:
// Yearly after completion
return (textOptions[0] <= 1) ?
string.substitute(this.yearlyAfterCompletionSummary, textOptions) :
string.substitute(this.yearlyEveryAfterCompletionSummary, textOptions);
default:
bigNumber: function bigNumber(val) {
let numParse = typeof val !== 'number' ? parseFloat(val) : val;
const absVal = Math.abs(numParse);
if (isNaN(numParse)) {
return val;
}
let results = numParse.toString();
if (absVal >= 1000000000) {
// Billion
numParse = numParse / 1000000000;
results = string.substitute(resource.billionText, {
val: dojoNumber.format(numParse, { places: 1 }),
});
} else if (absVal >= 1000000) {
numParse = numParse / 1000000;
results = string.substitute(resource.millionText, {
val: dojoNumber.format(numParse, { places: 1 }),
});
} else if (absVal >= 1000) {
numParse = numParse / 1000;
results = string.substitute(resource.thousandText, {
val: dojoNumber.format(numParse, { places: 1 }),
});
} else {
results = dojoNumber.round(numParse, 2).toString();
}
callPhone: function callPhone(action, selection, phoneProperty, title) {
if (!selection || !selection.data) {
return;
}
let actionInitiated = false;
this.setSource({
entry: selection.data,
descriptor: selection.data.$descriptor,
key: selection.data.$key,
});
lang.mixin(selection.data, {
Type: 'atPhoneCall',
Description: string.substitute(crm.Action.calledText, [selection.data.$descriptor]),
});
const value = utility.getValue(selection.data, phoneProperty, '');
crm.Action.recordToHistory(() => {
if (!actionInitiated) {
App.initiateCall(value);
actionInitiated = true;
}
}, selection.data, title);
},
sendEmail: function sendEmail(action, selection, emailProperty) {
getHeader: function getHeader(entry) {
return string.substitute(this.byText, [format.formatByUser(entry.UserName), format.date(entry.ModifyDate)]);
},
});
formatRelatedQuery: function formatRelatedQuery(entry, fmt, property) {
let toReturn;
if (property === 'activityId') {
toReturn = string.substitute(fmt, [utility.getRealActivityId(entry.$key)]);
} else {
const theProperty = property || '$key';
toReturn = string.substitute(fmt, [platformUtility.getValue(entry, theProperty, '')]);
}
return toReturn;
},
createLayout: function createLayout() {
formatSearchQuery: function formatSearchQuery(searchQuery) {
return string.substitute('upper(Name) like "${0}%" or upper(Family) like "${0}%" or ActualId like "${0}%"', [this.escapeSearchQuery(searchQuery.toUpperCase())]);
},
});
formatSearchQuery: function formatSearchQuery(searchQuery) {
return string.substitute('upper(Account.AccountName) like "${0}%" or upper(ErpExtId) like "${0}%"', [this.escapeSearchQuery(searchQuery.toUpperCase())]);
},
});
recordEmailToHistory: function recordEmailToHistory(email) {
const entry = {
$name: 'History',
Type: 'atEMail',
AccountName: this.entry.Company,
LeadId: this.entry.$key,
LeadName: this.entry.LeadNameLastFirst,
Description: string.substitute(this.emailedText, [this.entry.LeadNameLastFirst]),
UserId: App.context && App.context.user.$key,
UserName: App.context && App.context.user.UserName,
Duration: 15,
CompletedDate: (new Date()),
};
this.navigateToHistoryInsert('atEMail', entry);
App.initiateEmail(email);
},
callWorkPhone: function callWorkPhone() {
getEventQuery: function getEventQuery() {
const startDate = this.weekStartDate;
const endDate = this.weekEndDate;
return string.substitute(
[
'UserId eq "${0}" and (',
'(StartDate gt @${1}@ or EndDate gt @${1}@) and ',
'StartDate lt @${2}@',
')',
].join(''), [App.context.user && App.context.user.$key,
startDate.format('YYYY-MM-DDT00:00:00[Z]'),
endDate.format('YYYY-MM-DDT23:59:59[Z]'),
]
);
},
hideEventList: function hideEventList() {