Clarity

Expand all | Collapse all

Can an Action run an NSQL Query to Populate a Read Only Attribute?

  • 1.  Can an Action run an NSQL Query to Populate a Read Only Attribute?

    Posted Jun 16, 2016 11:51 AM

    I've built a custom object to house our benefits, along with a pretty long/complicated NSQL query to perform the calculations that we need in order to get to our Return on Investment. I've run into one hiccup in that the users will have to go to two separate places - one to enter the benefits (via the custom Benefits object in a list view) and the second to see the calculations (an NSQL portlet).

     

    Is there any way to either:

        A) When the user clicks Save, my NSQL query will run and the read only attributes will be populated

    or B) Build a script that runs from the Actions menu that will run the NSQL query and populate the read only attributes

     

    Being able to create new benefits from the portlet would also work, but it's my understanding from reading in the community that this is not possible and they have to be created from the Benefits List View through the object.

     

    Thank you in advance for any help!

     

    Heidi



  • 2.  Re: Can an Action run an NSQL Query to Populate a Read Only Attribute?

    Posted Jun 16, 2016 11:56 AM

    This technique might help you out ; TIP : How To Put Any Dynamically Generated Value On A Clarity Object

     

    It would allow you to put a dynamically generated readonly field (your ROI) onto your custom object ; it gets populated at displaytime so would refresh upon save/redisplay of the object page. As long as your 'complex' NSQL doesn't take long to execute, this would work I think.



  • 3.  Re: Can an Action run an NSQL Query to Populate a Read Only Attribute?

    Posted Jun 16, 2016 12:14 PM

    Davids hack works a treat, but depends on how you want it to display.

    It doesn't work in the list view sadly

     

    You can call a portlet from the actions menu which passes through parameters.

    See timesheet review for an ootb example



  • 4.  Re: Can an Action run an NSQL Query to Populate a Read Only Attribute?

    Posted Jun 16, 2016 12:24 PM

    ^ agreed ; list view is a problem for the 'trick' (not a 'hack' really )

     

    But in the original option [B] you don't need to initiate process from the Actions drop-down, can just do it on 'Save' of the custom-object - a process could run and update data back onto that custom object. The disadvantage of this (IMHO) is that you have to wait for the process to run, which might only be a few seconds but is never quick enough (in my experience) to present the data back on-screen without a further (manual) refresh of the page.

     

    I have also used that 'trick' to build a (parameterised) link to a portlet-page on an object-page (rather than linking to a portlet via the action drop-down) - same difference, less clicks?



  • 5.  Re: Can an Action run an NSQL Query to Populate a Read Only Attribute?

    Posted Jun 16, 2016 12:35 PM

    Yes that's also an option, a personal preference as it's more intuitive. (icon and bit of text)

    A bit off topic but with some magic your "trick" can be used to force refreshing once a process runs and stops when it completes



  • 6.  Re: Can an Action run an NSQL Query to Populate a Read Only Attribute?

    Posted Jun 16, 2016 01:02 PM

    Andrew Mowlam wrote:

     

    A bit off topic but with some magic your "trick" can be used to force refreshing once a process runs and stops when it completes

    Document that, and add it to the 'tip' please.



  • 7.  Re: Can an Action run an NSQL Query to Populate a Read Only Attribute?

    Posted Jun 21, 2016 11:02 AM


  • 8.  Re: Can an Action run an NSQL Query to Populate a Read Only Attribute?

    Posted Jun 16, 2016 01:47 PM

    Where could I find an example of doing this? This sounds like the direction I would like to go, but I honestly have never built a custom process.



  • 9.  Re: Can an Action run an NSQL Query to Populate a Read Only Attribute?

    Posted Jun 17, 2016 03:46 AM

    hcook wrote:

     

    Where could I find an example of doing this? This sounds like the direction I would like to go, but I honestly have never built a custom process.

    If you are replying to me here about the "trick", then its fully documented with worked examples in that link I gave.



  • 10.  Re: Can an Action run an NSQL Query to Populate a Read Only Attribute?

    Posted Jun 21, 2016 09:27 AM

    No sorry I meant to build the custom process. I'll do some digging in the community to try to find some instructions!



  • 11.  Re: Can an Action run an NSQL Query to Populate a Read Only Attribute?

    Posted Jun 17, 2016 03:16 AM

    That might be the solution to my problem as well.

    How would you know if there is the need to do update if the source has changed?