Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Recommended Posts

I want to create a random number generator that will help our team prioritize which row in a portal table they should act on. In a participant's record there are related eligible studies, if the participant has 3 eligible studies it is hard to determine which one should get picked first. So I tried to come up with a random number generator.

 

In the record and layout with the portal, I have a formula acting on sumeligible (i.e., the number of eligible records) as follows:

 

RandAssign: If(sumeligible>1;Int(Random*sumeligible)+1;1)

 

That works great, but it constantly updates, which makes sense because of "Random". However, I would only like it to update when sumeligible changes. If sumeligible doesn't change, I want it the field to stay the same.

 

Should I use a script? If so, how do I do that -- I am very new at scripting. Is there a way to do a GetValue command and then not have it recalculate until sumeligible changes? I'd really love some help/insight on this! Thank you!

Link to comment
Share on other sites

Attach an onObjectModify script trigger to the sumeligible field.

 

The script should be

Set Field[RandAssign; If(sumeligible>1;Int(Random*sumeligible)+1;1)]

Link to comment
Share on other sites

Thanks, doughemi.

 

I tried this, but it still always updates the number because I have over 1000 participants and each time I change to a different participant record the associated portal (and sumeligible, which is based off of the portal) is modified. Or perhaps there is another reason why and I am mistaken but something is getting modified regardless? Perhaps a different script trigger?

Link to comment
Share on other sites

I would only like it to update when sumeligible changes. If sumeligible doesn't change, I want it the field to stay the same.

 

each time I change to a different participant record the associated portal (and sumeligible, which is based off of the portal) is modified.

Then you DON'T want the randomizer to change when sumeligible changes.

 

So, do you have a field that really only changes when you want the randomizer to change?

Link to comment
Share on other sites

I would only like it to update when sumeligible changes. If sumeligible doesn't change, I want it the field to stay the same.

 

each time I change to a different participant record the associated portal (and sumeligible, which is based off of the portal) is modified.

Then you DON'T want the randomizer to change when sumeligible changes.

 

So, do you have a field that really only changes when you want the randomizer to change?

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

Terms of Use