I'm trying to create a link to launch a survey123 survey with attributes passed from the selected feature in field maps and then use the callback to return to field maps and update an attribute on the feature that the survey was launched from. I've been reading ESRI's documentation at https://doc.arcgis.com/en/survey123/reference/integratewithotherapps.htm and https://doc.arcgis.com/en/field-maps/ios/help/deploy-your-map.htm along with posts here in the community but can't get the attributes to update with the callback and not sure what I'm missing. I'm using the Arcade content within the popup to add the link and I've attached my Arcade code below. It launches Survey123 and populates attributes in the Survey as I want and returns to field maps when the survey is submitted, but I can't get the attribute to update on the callback.
featureSourceURL is the url to the hosted feature service and the layer within that service is layer 0. I'm thinking this might be part of the problem as if I past the url into the browser I get a token required page, but I've tried generating a token and adding the token to the url and that broke the callback.
var S123 = "arcgis-survey123://?itemID=###"
var S123_Attributes = "&field:Stand_Habitat_Type={Stand_Habitat_Type}&field:incoming={GlobalID}"
var Callback = "&callback="
var CallbackFM = UrlEncode("https://fieldmaps.arcgis.app/?referenceContext=updateFeature")
var callbackID = UrlEncode("&itemID=###")
var callbackFeatureSource = UrlEncode("&featureSourceURL=https://services1.arcgis.com/###/arcgis/rest/services/AspenSurvey/FeatureServer/0")
var callbackFeatureID = UrlEncode("&featureID=")
var callbackFeatureGlobalID = UrlEncode($feature.GlobalID)
var callbackFeatureAttributes = UrlEncode('featureAttributes={"ConditionSurvey":"Yes"}')
var fullCallback = CallbackFM + callbackID + callbackFeatureSource + callbackFeatureID + callbackFeatureGlobalID + callbackFeatureAttributes
var fullURL = S123 + S123_Attributes + Callback + fullCallback
return {
type : 'text',
text : '<a href=' + fullURL + '>Open Survey with Callback</a>'
}