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

RustyT
 Share

Recommended Posts

Hi

 

I'm looking to use a script parameter when clearing the contents of a container field so that I don't need to repeat the script across my solution.

 

My understanding is that when using the clear field script step, I can't select the field to clear using a calculation based on a script parameter.

 

Therefore, I've come up with a different method based on doing some reading around.

 

First, I set the script parameter as the object name for the container field.

 

The associated script is then as follows:

 

Show Custom Dialog (Are you sure you want to delete this file)

If [Get (last message choice)=1]

Go to object [Object Name: Get (ScriptParameter)]

Set Field [""]

End if

 

Is this method OK to use? It works, but I would like to understand what best practice is for what I'm trying to achieve.

 

PS. Rather than typing out my script as I have done above is there a better way of copying and pasting my script into this forum? Or should I just post as and image of a screenshot of the image?

 

Many thanks in advance for any assistance

Link to comment
Share on other sites

My understanding is that when using the clear field script step, I can't select the field to clear using a calculation based on a script parameter

 

Yes, sadly Go to Field[] cannot be abstracted. But why use Clear[] when you have Set Field[]?

 

You could also pass the script parameter as

 

GetFieldName ( YourTable::yourField )

 

and use Set Field by Name [ Get ( ScriptParameter ) ; "" ]

 

On the other hand, how many different container fields will you have in your solution? Ideally, it would only be one (container field in dedicated table), so the name would always be the same, only the context changes – which you can get with Get ( LayoutTableName ), meaning you could shift the calculation into the script and get rid of the SP (admittedly, that could be a bit more complicated with a portal).

 

PS. Rather than typing out my script as I have done above is there a better way of copying and pasting my script into this forum? Or should I just post as and image of a screenshot of the image

 

On OS X, open script, select print (or press Cmd-P), select Open in Preview, copy text, paste in post, post-process (that text usually has some line-breaking issues).

 

Post a screenshot only if there is no other way (in other words: don't). When people try to offer alternate ways of scripting, it's easier to copy from your script and modify than to type it from scratch.

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