Notifications
Announcements
No record found.
hello,
how I set currency field if value is greater than money then the result is multiply by 2 in same field
thanx
*This post is locked for comments
You can do this either using business rules or JavaScript, they should both work.
If you need further help please provide more details
hello Aric,
i Will get currency field new_money on contact entity
if the money is greater than 500 then the money is multiply by 2 and assign into same field that is new_money by using plugin
thnx
You can do this without plugin using JS or Business Rule.
If you want to use a plugin, it's simple enough code:
// Using Early binding
decimal moneyValue = contact.Contains("new_money") ? contact.new_Money.Value : 0;
// or Late Binding
decimal moneyValue = contact.Contains("new_money") ? ((Money)(contact["new_money"])).Value : 0;
if (moneyValue > 500)
moneyValue = moneyValue * 2;
// Call function to Update Money Value
UpdateMoneyValue (Guid contactId, decimal moneyValue)
// Function to Update Money Value
private void UpdateMoneyValue(Guid contactId, decimal moneyValue)
{
Entity contact = new Entity("contact");
contact.Id = contactId;
contact["new_money"] = new Money(moneyValue);
service.Update(contact); // Inside try..catch block
}
Hello,
Aric,
I write this code on message=Update, primary entity=contact, stage=post-operation
and i am getting this error,
Hi Kiran,
You have to write the Context.depth in the plugin code.
after this line You have to write the Context.depth
decimal pricevalue=money.value;
if(context.depth=1)
please mark as Verified if it works.
thanx , krishna
i have done it by using context.depth
Get : -
var moneyValue = ((Money)item.Attributes[attributeName]).Value;
Post : -
newSalesOrder[attributeName] = new Money((decimal)moneyValue);
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2