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

session.establised is triggered when you loggin i.e. when a new session is establised. This runs your script action.


Script action with session.establised can be used to GlideRecord and prepare the data which rarely changes and is used frequently.


So you are messing up things here. You cannot do what you want to achieve.



What you are trying can be simple achieved by writing a client script on your first table and do a GlideAjax call to script include which will get the caller on the form as a parameter and set it on the second record. On doing this whenever you open your second form or reload it the caller will be set on it. But here you need at least reload or reopen.



Please read Two ways to Reduce Client Side lookups. This will give you a clear idea.



I hope the example give in the link will help you



Thanks,


Tanaji