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

Notifications

Announcements

No record found.

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

    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

    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

    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

    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

    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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans