rbv_api.setSharedValue Return null

Posted by refael shira on 14-Dec-2016 04:09

Hello,

I using in rbv_api.setSharedValue and it's not working.

my code is:

var a = "temp";
rbv_api.setSharedValue("ObjectName", a);
var str = rbv_api.getSharedValue("ObjectName");
rbv_api.println(str);

I can't use in another trigger and when I print the shere value (even in the current trigger) I get null.

It's a bug? 

Any ideas?

best Regards,

Refael

Posted by refael shira on 18-Dec-2016 01:07

Thank you,

I used in the api.log and I understand the problem.

Refael

All Replies

Posted by Srinivas Panyala on 14-Dec-2016 04:36

Hi Refael,

When you run the trigger it works. In Debug formula it displays null.

I have tried the following steps;

1) Same code I have put it in an object script trigger with After create timing.

2) I have added the below log statement to print in the log

rbv_api.log("debug", "sharedValue: "+a);

3) After record created, this trigger executed and printed the value in logs

debug log is available at Object Definition -> Triggers -> Log

Thanks

Srinivas

Posted by Srinivas Panyala on 14-Dec-2016 04:44

Sorry. I have mentioned the wrong variable in the rbv_api.log statement. The following statement is correct. It works.

rbv_api.log("debug", "sharedValue: "+str);

Thanks

Srinivas

Posted by Nitin Kumar Singh on 14-Dec-2016 05:00

Hi Refael,

API's setSharedValue and getSharedValue do not work during 'Debug Formula' mode because this mode does not have complete transaction context. I was, however able to set and get shared values in an object script trigger type with two different timings : before and after update.

I have attached a sample app which showcases these APIs: [View:/cfs-file/__key/communityserver-discussions-components-files/25/Community_5F00_v1.xml:320:240]

Does this help? If not, can you please share which trigger type (Object Script, Validate Record Data etc) are you using and your general use-case.

Thanks,

Nitin

Posted by refael shira on 14-Dec-2016 05:16

Hi everyone,

I use in object script trigger with After create timing who called "triggerA".

in this trigger I use rbv_api.setSharedValue.

after this I run another trigger who called "triggerB" by this api:

rbv_api.RunTrigger("triggerB").

I tried also to run triggerB with after create timing but it's still not working.

Thank you,

Refael

Posted by Nitin Kumar Singh on 14-Dec-2016 07:34

Hi Refael,

I tried calling the second trigger with runTrigger and getting the shared value there. It worked for me. Can you please attach a sample app xml for us to reproduce your issue.

Thanks,

Nitin

Posted by refael shira on 18-Dec-2016 01:07

Thank you,

I used in the api.log and I understand the problem.

Refael

This thread is closed