Session Client Data

sowmyarajaram
Tera Expert

Hi All,

Im trying out with the session client data.

I have two forms and a field called "caller" in the first form(reference field) and a field called caller_id in the second form(also a reference field).

If is select a user(for the field caller) in the first form and move on to next form again in the second form caller_id field I need the same value.

Currently using this

In script Action:

setUserValues();

function setUserValues() {

  var session = gs.getSession();

  session.putClientData('wizardvalue', 'caller');

  gs.log("value of session" + session);

}

In Client script:

function onLoad() {

    //Type appropriate comment here, and begin script below

    var val = g_user.getClientData('wizardvalue');

  g_form.setValue('caller_id', val);

  g_form.addInfoMessage("val " + val);

}

But this is not working. So I have the question like in the script action, "putClientData" can I user the name of the field in the first form?, Or where Im going wrong?

Thanks,

Sowmya

5 REPLIES 5

Tanaji Patil
Tera Guru

Hi Sowmya,



I don't know which event you are using to trigger your script action.


But


session.putClientData('wizardvalue', 'caller');


in this line you are simply passing the string 'caller' and not the value of the 'caller' field which should be a sys_id.


First get the sys_id of the user in caller field and then pass it the above line of code.




Thanks,


Tanaji




If you need help on using Script Action and Client Script together please see


Two ways to Reduce Client Side lookups


Hi Tanaji,



The event im using is "session .established".



And as you said yes I was just looking for the string "caller", but how could i look for the value of the first form?, I directly tried giving the sys_id, but that did not work.


How do i query for the dymnamic value for the field in first form?