Totals function

Totals function

Hey,

 

I am trying to write a custom function to calculate Quote totals to include at the Deal level. Here is the function:

 

https://www.zoho.com/crm/resources/tips/functions-grand-total.html

 

RelatedQuotes = zoho.crm.getRelatedRecords("Quotes", "Deals", potId.toLong(),1,200); //info RelatedQuotes;

total = 0.0;

for each ele in RelatedQuotes

{

grand =ifnull(ele.get("Grand_Total"),"0.0").toDecimal();

total = (total + grand);

}

mp = map();

mp.put("Amount", total);

update = zoho.crm.update("Deals", potId.toLong(), mp);

info mp;

info update;

 

I select related module as “Deal”

 

I enter above script and edit argument as specified, dealId = Deal Id

 

I execute and prompted:

 

"Please enter the input values to the arguments

int potId = _______________________"

 

If I enter “Deal Id” I return error: Failed to execute function - Error at line number: 1
Value given for the variable 'potId' does not match its type

 

I am assuming that is because potId should be dealId? I enter script as:

 

RelatedQuotes = zoho.crm.getRelatedRecords("Quotes", "Deals", dealId.toLong(),1,200); //info RelatedQuotes;

total = 0.0;

for each ele in RelatedQuotes

{

grand =ifnull(ele.get("Grand_Total"),"0.0").toDecimal();

total = (total + grand);

}

mp = map();

mp.put("Amount", total);

update = zoho.crm.update("Deals", dealId.toLong(), mp);

info mp;

info update;

 

I edit arguments, dealId = Deal Id

 

I execute script and prompt:

 

"Please enter the input values to the arguments

int dealId = _______________________"

 

If I ender “Deal Id” I return error: Failed to execute function - Error at line number: 1
Value given for the variable 'dealId' does not match its type

 

 

 

 

 

Any Ideas??

 




      • Topic Participants

      • nate

      • Sticky Posts

      • How to Add Users to your Organization in ZohoMail?

        A better clarity so you can create other users to start using Zoho Mail. You can directly Add Users from the Control Panel to your Organization. You can invite users with the existing email address. If the person (user) already uses ZohoCRM, then you can import users from Zoho CRM. You can also import them using a .csv file. (if you are planning to add them in Bulk)  In this topic, We will be discussing on how to Add and Invite users only.  The Import options are self explanatory. ____________________________________________________________________________________________________________