Table of Contents |
---|
Summary
This document lists available scripts for use as actions in EngageIP. For more information on actions see the article Extending EngageIP With Action Scripts.
Adding Action Scripts
To use these scripts, click on Action link on the Setup tab page and paste the code in as shown, enter a descriptive name and click Save. The action scripts can then be selected for use under Credit Rating / Payment terms for example.
Late Fee Script - Percentage of Invoice Balance
Info |
---|
Note: For late fee scripts, be sure to update the associated Service name to match an existing service in your deployment. The Service name is required for taxing and reporting purposes. |
This script will add a late fee calculated as a percentage of the invoice balance based on the value you enter in the 'Rate' field. If you need the system to add a rate like 1.5% rather then a whole number you can convert the rate profile question to a datatype of 'double'. This allows you to enter 1.5 which will be calculated down to 0.015 in the script below.
Under the action created, click add to add a profile question, configure it as below (both for percentage or flatfeeflat fee). When you add the action to credit rating, it will request the percentage or flat fee you want to add according to the action you've selected in this KB.
...
This script sends an email when an invoice has an overdue balance. The profile questions will take the name of the email message setup under 'email messages' on the setup tabpage.
Code Block |
---|
//Name: SendEmail //Description: //EventCode: var user = User.GetByID(Convert.ToInt32(context["UserID"])); var emails = user.GetOwner().SearchEmailMessageByName(context["EmailMessage"].ToString()); if (emails.Length > 0) { var coreEmail = (Logic.Core.EmailMessage)emails[0]; coreEmail.SendTo(user.ID); return true; } return false; |
Send Email if User Status IS NOT 'Canceled'
Info |
---|
Note: this script references the back end status, not the defined label status on the setup tab. Available back end statuses are 'Canceled', 'Active', 'Suspended' and 'Prospect'. |
Code Block |
---|
//Name: SendEmailUserStatusNotCanceled //Description: //EventCode: var user = User.GetByID(Convert.ToInt32(context["UserID"])); EventLogger.Log(user.ID, user.ID, "SendEmailUserStatusNotCanceled", "CustomCode", string.Format("User's current StatusType: {0}", user.GetCurrent_StatusType().Name), user.OwnerID, "User", user.ID, null); if (user.GetCurrent_StatusType().Name != "Canceled") { var emails = user.GetOwner().SearchEmailMessageByName(context["EmailMessage"].ToString()); if (emails.Length > 0) { var coreEmail = (Logic.Core.EmailMessage)emails[0]; coreEmail.SendTo(user.ID); return true; } } return false; |
...
Similar to above, an if statement will set the user status when the account is not in a status of 'canceled'.
Info |
---|
Note: When setting an account status to canceled the system will cancel any packages and add a prorated refund by default. If you do not want a prorated refund you can create a status of 'Suspended' with a back end status of 'Active'. You can then track who has this status and perform administrative tasks on them as needed, enable, charge credit card manually, etc. |
Code Block |
---|
//Name: SetUserStatusWhereNotCanceled //Description: //EventCode: var user = User.GetByID(Convert.ToInt32(context["UserID"])); EventLogger.Log(user.ID, user.ID, "SetUserStatusWhereNotCanceled", "CustomCode", string.Format("User's current StatusType: {0}", user.GetCurrent_StatusType().Name), user.OwnerID, "User", user.ID, null); if (user.GetCurrent_StatusType().Name != "Canceled") { var userStatusType = user.GetActingOwner().SearchUserStatusTypeByName(context["UserStatus"].ToString())[0]; if (userStatusType != default(UserStatusType)) { user.UserStatusTypeID = userStatusType.ID; user.Update(); return true; } } return false; |
...
Balance Threshold Wrappers
This script is used to include thresholds like invoice balance thresholds into the logic, see below options. For assistance on using these, please contact LogiSense customer support.
LogiSense Support | email: support@logisense.com |
web: Live Support
phone (Canada): 1-519-249- |
0508 | phone (USA): 1-917-410-3584 |
The below script checks profile question on the action called 'Threshold' and will only execute its payload (in this case an email user script) if the invoice balance is greater than x (as //configured in the profile question.
...
On each action you will need to add these Profile Questions:
Name | DataType |
Threshold | Double |
EventLogMessageOnThresholdNotMet | Text |
EmailMessage | Text |
Write Off
This write off script requires two profile questions on action:
...