Select to view content in your preferred language

Survey123 Don't overwrite calculated variable on resubmission or survey

420
1
02-20-2022 09:04 AM
TylerSavoy
New Contributor

I have an attribute field that gets duplicated on submitting a survey.

Seed Point ID is replicated in Legacy Seed Point ID.

I want to keep a record of the Seed Point if the site falls through and the attribute gets changed to "No Seed Point."  I have the users open up an exiting sites survey, make any changes and resubmit the survey to update the records.  When changing the Seed Point status to "No Seed Point," it moves that value into the Legacy Seed Point ID.  Is there a way to disable the JS script on resubmission for edits?  I was also trying to set up a JS script to handle this but had no luck.  It doesn't look like I can pass the variable itself to the script

function legacyseedrun(seedpointid) {

// Set up query parameters

var leg = seedpointid;

let outValue = "";

if (seedpointid == "No Seed Point") {

outValue = leg;

}

else{

outValue = seedpointid}

return outValue

}

0 Kudos
1 Reply
BennetGigliottiManHydro
New Contributor II

Use the property pulldata("@property", 'status') 

Returns draft, submitted, sent, or inbox if the survey was opened from Drafts, Outbox, Sent, or Inbox, respectively. An empty string is returned if the response is new.

0 Kudos