Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Suggested answer

Autocalculate javascript field from excel importing

Posted on by 25

Hi friends. 

I have an entity with a calculate field that onload event form gets a javascript value. It works fine manually record creation. But importing from excel....

I need to import using this excel template lots of records. It works, but...... this javascript calculate field does not refresh

I have to edit each record and save it again without changes. After, once in every year, those records had to recalculate (Programmed Process task) 

My 2 question:

- Is possible to update the field value during the import?

- Is possible to create a bussiness process to refresh selected records?

Thanks in advance

  • Suggested answer
    Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    RE: Autocalculate javascript field from excel importing

    Hi Partner,

    it's hard to compare difference between two dates and grt difyear in the workflow.

    Maybe you can try to use power automate to create one flow, it can get difyear:

    https://powerusers.microsoft.com/t5/General-Power-Automate/Getting-years-between-two-dates/td-p/815131 

  • Gardagantxo2007 Profile Picture
    Gardagantxo2007 25 on at
    RE: Autocalculate javascript field from excel importing

    Hi again, thanks for the response Adrian a Leuh.

    Yesterday I post a response, but I can't see it. Something was wrong publishing, I think.

    I have a form field that contains a initial year (like 2013 value for example)

    I have a form field (option set named period) that contains: 1 year, 2 years, 3 years,.......

    I need the dif between current year and initial year: 2023 -2013 = 10 (Javascript value stored on  javascript var difyear)

    I have a yesno field updated by this calc like:

        If period == " 2 year" and difyear == (2,4,6,8,10,12,14,16.....) then  yesno=true

        If period == " 3 year" and difyear == (3,6,9,12,15,18.....) then  yesno=true

    .........................................

    I don´t know how to do with workflows. I'm not an expert. Any idea?

    How can I get current year in a workflow condition to evaluate the dif between initialyear?

    I think it is possible with a plugin, but I'm not an expert programmer.

    Thanks in advance.

  • Suggested answer
    Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    RE: Autocalculate javascript field from excel importing

    Hi Partner,

    JavaScript works only on client side i.e. when you access form on a browser and not on server side i.e. when you importing record through Excel.

    Mayee you could use workflows/flow to update your fields which will run when you import the records.

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: Autocalculate javascript field from excel importing

    Hi Gardagantxo2007,

    Can you please post the condition and action for your calculated field. You need to populate the values specified in the calculated field calculation for the field to display the value correctly.

    It sounds to me like you are trying to use On Load JavaScript instead of using a proper calculated field. On Load JavaScript does not trigger when importing an Excel file.

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,552 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,552 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans