javascript web resources RRS feed

  • Question

  • Can I call a function in one web resource into another function which is in another web resource?

    Is this possible?

    I need to call a function OnChange which returns a value into another function OnLoad, so that I can use that value.

    Please let me know what do you think.


    Thursday, July 3, 2014 5:42 PM

All replies

  • Hi,

    This should be possible, just make sure you add both files to the form so that CRM had them both loaded into memory and knows where to look to find the other function.

    ~ Atomic Coder

    Thursday, July 3, 2014 7:34 PM
  • I did add both files to the OnLoad form(i.e the main form where I want to use the Onchange function's return value).

    And also I made sure to add the OnChange file on top of OnLoad but still I don't see the changes.

    I actually tried with an 'alert' to see if the value is coming or not but I don't even see the alert message box.

    What could be the reason? Do I need oData query to retrieve values in this scenario.

    Please let me know.


    Friday, July 4, 2014 2:08 AM
  • Hello Friend,

    You can write multiple function in a single web resource. So write both function in a single webresoure and call the other function there itself.


    function xyz()



    var x=abc();  //calling abc function


    function abc()


    ..perform logic


    So you need to call only function xyz in onload. Here entire code need to be in one web resource.

    Hope you got it n it might clear your issue.

    Prudveen D If the answer helped you, remember to mark it as answer.

    Friday, July 4, 2014 4:41 AM