Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Highlighted
Tuned Listener
Posts: 18
Registered: ‎03-16-2010

Setting Field Values At Run-Time

What is the best way to set the text property of a screen object at run-time?

 

Scenario:

SLX Web v7.5.2

Opportunity Detail Screen with:

Field A (Saleslogix Picklist control)

Field B (Saleslogix Date Time Picker control)

 

When a user changes the value in Field A, the value of Field B needs to be set to the current date.

 

I've tried various server-side methods (OnChange Action via Code Snippets).  I believe they run successfully, but the updated value in Field B never displays.  I've tried client-side via JS and haven't had much luck attaching JS to a Picklist web control.

 

Any help/code examples would be much appreciated.  Thanks.

Highlighted
Employee
Posts: 320
Registered: ‎03-30-2009

Re: Setting Field Values At Run-Time

Mark,

 

Try changing the value of the Entity Property bound to the control instead of changing the value of the control directly.

 

If you're going to use a C# Code Snippet, you have to get the current entity.  Below is an example of getting an account entity (on an account form).

 

Sage.Entity.Interfaces.IAccount account = this.BindingSource.Current as Sage.Entity.Interfaces.IAccount;

 

Highlighted
Tuned Listener
Posts: 18
Registered: ‎03-16-2010

Re: Setting Field Values At Run-Time

Thanks.  That technique is something I had originally tried; it worked halfway.  While that *does* reset the value correctly behind-the-scenes, there's no visible indication on the screen that the value has changed.  If I were to save/reload the detail screen via the Save button in the UI, the updated value would then display as expected.

 

Is there a way to trigger a screen refresh after modifying the myentity.ThePropertyGettingUpdated value on the entity?  I had tried getting the entity to rebind after updating the property (to show the updated value to the user) without success.

 

Thanks,

Mark

Highlighted
Employee
Posts: 320
Registered: ‎03-30-2009

Re: Setting Field Values At Run-Time

You shouldn't have to do anything to have the value refresh.


Can you post or email me your code snippet?