Discussion

Using the pega.ui.d.getProperty and setProperty functions

Hi all,

I'm trying to use the pega_ui_doc API to set and get properties in JS. Given that I've yet to be successful, I'm clearly not using these functions correctly.

Essentially, I have a property, "Test", in my applications work class. I'm calling the following in js:

 

pega.ui.d.setProperty("Test", "600");

var foo = pega.ui.d.getProperty("Test");

 

However, 'foo' remains undefined.

I have an... imperfect understanding of pages. I've tried specifying the page in these functions, for instance:

pega.ui.d.setPropery("Test", "600", "pyWorkPage");

with no luck. Probably because the property isn't actually on pyWorkPage. But I have no idea where it would be.

 

I would be grateful for any insight anybody has. Thanks!

**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

December 10, 2013 - 2:15am

Hi ,

When you calling this functions is the defined property is present in the UI. Make sure it is referred in the UI (text box radio button check box,  etc).

December 10, 2013 - 10:48am

Hey, thanks for your quick reply!

The variables aren't defined in the UI at the moment unfortunately. Because I'm using a custom HTML Section, there's no place to define the variables within the section.

December 11, 2013 - 1:12am

Actually since this is javascript it is run on client side. We need to have the properties defined on the UI . Code will look for the value by getting the element which is defined on the UI.

For ex: Property Name defined on the section rule and associated with a textbox. then this property value we can get from the above functions.

 

December 11, 2013 - 5:59pm

If you look at the function definition in pega_ui_doc.js, you'll see that it's going to call this first: pega.u.property.toHandle(propertyName) to get the element id. And then confirm that this is on the document.

Are you invoking this JS from a Pega-generated form? (such as a harness, flow action, etc)

Jon

March 26, 2014 - 6:55pm

Where did you find the Pega JS API? For using functions like the mentioned above:

pega.ui.d.setProperty

pega.ui.d.getProperty

I tried looking for those in PDN, but no luck so far... Just randomly reading articles like your question, is that I figure those functions exists...

Thanks,

Jose

 

March 27, 2014 - 7:32am

Hi Jose,

You can find JS APIs in help. Click on help button in Process Commader the goto APIs --> Desktop.

 

Regards

-Suresh Gunawardane-

March 27, 2014 - 12:43pm

Well, the JS APIs got canned in v7 -- Pega is discouraging use of JS going forward.

You can re-create JS API docs through Rule-Doc-JS.

Still, to understand what code is doing when the documentation isn't clear enough, use the source, Luke.

March 27, 2014 - 2:03pm

"use the source, Luke"

Jeje :) thanks JonnyGar. Thanks Suresh too.

 

I've figure out how to use pega.ui.d.getProperty(), inside my JS function:

var birthdate = pega.ui.d.getProperty(object.displayName);

 

Now birthdate is "27.03.2014" since I'm in german locale... But to perform my function calculations I wish birthdate would be in ISO format like "20140327T040000.000 GMT". The latter value is actually in the clipboard when I submit the form, but I'm trying to do my verification without submitting... Is there a way to get the property value as stored in the clipboard?

Thanks for any ideas or thoughts on that.

Regards

October 9, 2015 - 12:46pm

Hi Jose

Could you give a more complete example of the using method pega.ui.d.getProperty & pega.ui.d.setProperty

 

Regards