Skip to main content

We have a customer using the form in CLM to generate a sales order.  Entering data on the form is very straight forward but now they are also looking to multiply widget a * widget b, potentially multiple sums, to get a subtotal amount.  Is there an example of an C# expression that I can use to drive this result?  I am also using a number field for one and currency for the other so assume that is correct?

Any guidance is appreciated.

Any assistance would be greatly appreciated.  Thank you!


Hello ​@sgreer 

Welcome to the DocuSign Community!

Can you give me a specific scenario or example of that, then I will be able to assist you better.

👪 DocuSign Community Leaderboard Top 5 contributor
💹 Ranked #3 in the Reply Royalty category in DocuSign Community Wrapped 2024
🤝Let’s LinkedIn and rollPawan Gangwani - EY | LinkedIn 


Sure we have two attributes in a form document that we are looking to have multiplied together.  Those values could vary based on the sale price and quantity so we need the reference to look at the values in those attributes when multiplying.  We may need this for a single math calculation but are scenarios where multiple groupings will need to be multiplied and summed together.

Lastly, we would like for that subtotal to then be added back to the DocGen form but are struggling to find documentation or process on how to do that.  

I know this is a lot but if there is any assistance or direction it would be appreciated.


Hey ​@sgreer,

Thanks for sharing the details not too much at all! This kind of calculation can absolutely be handled within the CLM workflow using C# scripting, but it depends on how dynamic your use case needs to be.

If you're multiplying two attributes (like sale price × quantity) and potentially summing multiple groupings, you’ll want to use a C# script that:

I recommend writing a C# script step in the workflow that:

  1. Parses the dynamic values,

  2. Calculates the subtotal,

  3. Stores the result into a workflow variable,

  4. Then maps that variable back into your DocGen (Second Form) template for output.

Thanks!

👪 DocuSign Community Leaderboard Top 5 contributor
💹 Ranked #3 in the Reply Royalty category in DocuSign Community Wrapped 2024
🤝Let’s LinkedIn and rollPawan Gangwani - EY | LinkedIn 


Thanks ​@Pawan Gangwani!  The one we just cannot figure out is #4 noted above.  Seems that we were finally able to get the math to work but are stuck on getting it back into the document.  Is this all in the same calculation script or do we need to establish another step in the workflow to get that initiated?


Hey ​@sgreer 

Yes, I agree that part can definitely get a bit complex. But I can share the structure that usually works:
You’ll need to use the “Create and Upload Document” step in the workflow. For that, you’ll have to create an input XML variable that includes all the fields and values you want to pass back into the DocGen form.

That XML will act as the source data when generating the final document with your calculated values merged in. Let me know if you’d like help structuring that XML or setting up the workflow step.

Thanks!

👪 DocuSign Community Leaderboard Top 5 contributor
💹 Ranked #3 in the Reply Royalty category in DocuSign Community Wrapped 2024
🤝Let’s LinkedIn and rollPawan Gangwani - EY | LinkedIn 

 


 


Reply