AnsweredAssumed Answered

How would I script this?

Question asked by brian.curran on Sep 27, 2011
Latest reply on Sep 29, 2011 by brian.curran


How would I script this?


On the 'Sites' layout, I have a "__kpSiteID" field and the corresponding "SiteName" field.
Below these two fields I have a portal to the 'Addresses' table which has the "__kpAddressID" and corresponding "Address" field.

My script fires when a button is clicked (add Address to Site). Clicking into the first portal row displays a drop-down list so that I can choose an Address to associate with the SiteName.

What I want to happen is this:
Capture the __kpSiteID from the Sites table and paste it into the _kfSiteID field in a Join table 
Capture the __kpAddressID from the last portal row (if it isn't blank) and paste it into the _kfAddressID field in the Join table. 

The problem I've got is that the script doesn't capture the second variable if an Address hasn't been selected. I.e. it jumps straight past this step so the _kfAddressID field in the Join table remains blank.

I don't want to use the Paus/Resume script step if possible, as it's not always obvous that the 'Continue' button has appeared. Would an 'If' and 'End if' statement work?