Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Cant fix the Error Value should be of type: number: Parameter Name: value

Posted on by 10

Hello everyone, 

I am new to this forum so please be patient with me :) 

I wrote a lot of scripts in the version 9 and they all worked (and still work) so i wrote following script (shortened) 

function myFunction(executionContext) {
    var start = Xrm.Page.getAttribute('field1').getValue();
    var end = Xrm.Page.getAttribute('field2').getValue();

    var resolution= end - start;
    executionContext.getFormContext().getAttribute('field3').setValue(resolution);
}
I can run this script on the "old" interface (custom entity in the options-cockpit) or i can run this script in the new unified interface (new custom cockpit, showing my custom entity) 
When i run this script on the "old" form, it succeeds and everyone is happy. 
When i run it in the new unified interface i get following error: "Value should be of type: number: Parameter Name: value
I am sure it is not a mistake from myself, because the script works in the old form. Does anyone have the same mistake and has a solution to it ? 
Kind regards, 
Rare
  • Suggested answer
    damka Profile Picture
    damka 120 on at
    RE: Cant fix the Error Value should be of type: number: Parameter Name: value

    use parseInt(your data)

    and it will work

  • Suggested answer
    Rare1402 Profile Picture
    Rare1402 10 on at
    RE: Cant fix the Error Value should be of type: number: Parameter Name: value

    Hi Everyone, 

    i was able to solve this error by changing the Context and using the execution Context instead of the Xrm.Page-Part. 

    KR Rare 

  • Laurentf2006 Profile Picture
    Laurentf2006 50 on at
    RE: Cant fix the Error Value should be of type: number: Parameter Name: value

    Hi Yogesh

    Could you please send us the solution?

    Thanks

  • larry schondorf Profile Picture
    larry schondorf 15 on at
    RE: Cant fix the Error Value should be of type: number: Parameter Name: value

    can i ask how?

  • Y0g3sh Profile Picture
    Y0g3sh 5 on at
    RE: Cant fix the Error Value should be of type: number: Parameter Name: value

    I resolved the error.

  • Rare1402 Profile Picture
    Rare1402 10 on at
    RE: Cant fix the Error Value should be of type: number: Parameter Name: value

    Hey Miguel,

    thanks to your fast support, I appreciate it a lot.

    1. the part i removed from the Code is following: i have to calculate the time so i get a value, recalculate it into a time format and then i make it this way: Resolution = Hours(var) + "," + Minutes(var) ;

    In the old CRM it does not Count as an number. The Field is a Dezimal Number Field.

    2. I have multiple Errors like this. Another one is: Value should be of type: DateTime: Parameter Name: undefined

    And in this case it is definately a DateTime Field and i use "formContext.getAttribute("sico_buchungsdatum").setValue(Date.now());

    So i dont think it is About the fields (otherwise i would get an error in the old form as well)

    Thanks for every help,

    Kind Regards,

    Rare

  • Suggested answer
    RE: Cant fix the Error Value should be of type: number: Parameter Name: value

    I've tried directly from the console:

    pastedimage1583257219934v1.png

    and from old UI I don't have any error, only an alert

    :pastedimage1583257530004v1.png

    So, almost for sure the problem is one of your fields is not a number.

    Hope it helps

  • Suggested answer
    RE: Cant fix the Error Value should be of type: number: Parameter Name: value

    Hi Rare,

    I only have this type of error when trying to update a field number with a string.

    Maybe one of your values (field1 or field2) is a string rather than a number?

    Regards,

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans