web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Javascript to sum Qty field

(0) ShareShare
ReportReport
Posted on by

Hello all, is there a way to sum values using javascript?

There is a custom Batch Number which can have products. The same product can be in different Batch, but the code below is only getting the latest Qty value, I need to sum them.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    JohnAnonymous Profile Picture
    5,241 on at
    RE: Javascript to sum Qty field

    I don't understand your question completely, but it should be the following process:

    1. Create a variable to store your Qty

    2. Create a query that returns all applicable product / batch combinations

    3. Iterate over the collection results and add the Qty from on record to the variable created under 1.

  • Verified answer
    Alagunellaikumar Profile Picture
    6,212 on at
    RE: Javascript to sum Qty field

    Create a Qty in the global variable

    Create a query for product entity filter by product number.

    Iterate the collection of return value from the above the query

    Qty += result.quantity;

  • JohnAnonymous Profile Picture
    5,241 on at
    RE: Javascript to sum Qty field

    Did any of the responses help? If not, any questions? If so, could you please mark an answer as verified?

  • Verified answer
    Drew Poggemann Profile Picture
    4 on at
    RE: Javascript to sum Qty field

    Hi Tekwise,

    I would suggest using a rollup field for what you are trying to accomplish here if you have a 1-N relationship between the Product and the Batch.  You should be able to do this in CRM without any custom code.

    Hope this helps.

    Thanks,

  • Verified answer
    Jharana Baliyar Singh Profile Picture
    2,667 on at
    RE: Javascript to sum Qty field

    Hi Tekwise,

    You can use Rollup fields for ur requirements.

    Plz have a look around below link:

    www.softwareanswers.co.uk/.../aggregate-calculations-in-microsoft-dynamics-crm-2015.html

    Thanks,

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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans