cancel
Showing results for 
Search instead for 
Did you mean: 

While Executing a Javascript got RuntimeException - org.mozilla.javascript.EvaluatorException: uSetContextVar: Only valid for Provisioning jobs at line

devaprakash_b
Active Contributor
0 Kudos

Hello Experts,

I am receiving an error whenever i am executing a java script file. I am calling the script in the below fashion.

MSKEYVALUE  - $FUNCTION.DP_getMskeyValueForUser(%ABCD01%)$$



function DP_getMskeyValueForUser(Par){

---- Here we have written logic---

       var result = uSelect(query);

 

      result = DP_generateId("CREATE");// calling another script

 

    return result;

}

function DP_generateId(Par){

--------------Here Code Logic ----------------------

--------At ending setting the output value and storing it in the context variable

    uSetContextVar("new_mskeyvalue", newMskeyValue);

    return newMskeyValue;

}

While executing i am getting an error message at the above highlighted part stating that got RuntimeException - org.mozilla.javascript.EvaluatorException: uSetContextVar: Only valid for Provisioning jobs at the line

Can you kindly please help me with this error.

Regards,

DP

Accepted Solutions (1)

Accepted Solutions (1)

terovirta
Active Contributor
0 Kudos

Are you calling the uSetContextVar from batch job or provisioning task? I think it only works from provisioning tasks (tasks in Id Store not from jobs in Job Folder).

regards, Tero

Answers (2)

Answers (2)

devaprakash_b
Active Contributor
0 Kudos

Hi JP and Tero,

the answers were helpful. By mistake i was using the scripts used for the same job, now i have re written the scripts.

Regards,

DP

jaisuryan
Active Contributor
0 Kudos

Hi DP,

Hope this helps.

context var is used if you want to pass values between tasks. If you are using in a job and you want to use values between passes, then you could use a job variable. Or if you want to calculate and use the values in same pass in the job, you can use a Hashmap.

Kind regards,

Jai