Discussion

Clipboard page property is not being read into js

I am using below js snippet to run an activity from js and then it is needed to read a clipboard page property from there to be used as variable but it is not letting me do that by throwing syntax error though there is apparently none.

var oSafeURL = new SafeURL("Class.Activity");
 oSafeURL.put("Parameter", Parameter Value);

var callback2 =                  
        {
       success: function()
                {
                       console.log(arguments);
        },
      scope: this
     }
 pega.u.d.asyncRequest('GET', oSafeURL, callback2, null);

var pyIDs;

pyIDs =  '<%= tools.findPage("clipboard page").getString("clip board page property")%>';

As soon as i remove the (' ')quotes from the line in bold above it gives js syntax error and do not let me check in without that and code does not run properly (alerts do not trigger).

If i save as it is given above hard coded value returns and so of no use for me.

Other than this i have used show page in the activity for that page to check if it is setting properly and found that ok.

I have also used pyIDs = <%= ClipboardPage.ClipBoardPageProperty %> instead of the bold line as above in the code and left with the similar problem.

Please help.

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

Pega
April 22, 2016 - 9:52am

Within what rule type are you doing this?   HTML Fragment or Rule-File-Text?

Rule-File-Text is meant to be purely client-side executed JS - not something the server modifies before being sent to the browser.

 

April 25, 2016 - 9:53am

Hello Pedel,

it is in Rule-File-Text. On click of a button in an external application, this js is being executed and it is working fine in all other respects. Only thing is that we are not finding the result of that activity to process in the same js in later stages.

June 8, 2016 - 9:26pm

Hi Shivendra,

Use Show-Property method in the activity you are calling from JS to return the value of the property you need. This will basically return the property in the XML response to javascript code.

Then implement callback as below to read xml response -

var callback = {
            success: function(oResponse){
                var IDs = oResponse.responseText;
                ..
            },
            failure: function (oResponse) {                
            }    
        };