I am trying to update Subscriber status using following Ampscript code. Can someone please assist on what could be wrong with the code. It gives following error message -

Error Message: Update or insert of view or function 'C7229040._subscribers' failed because it contains a derived or constant field.

Code :



2 Answers 2


you can not use DataView to update the subscriber status. you should use API AmpScript functions and below is the sample code for your reference.

SET @Subscriber = CreateObject("Subscriber")
SetObjectProperty(@Subscriber, "SubscriberKey","[email protected]")
SetObjectProperty(@Subscriber, "EmailAddress", "[email protected]")
SetObjectProperty(@Subscriber, "Status", "Active" )
SET @Status = InvokeUpdate(@Subscriber, @createErrDesc, @createErrNo, @createOpts)


The following lines work for me. The @Unsub_All variable either took the value of "Active" or "Unsubscribed".

Note: This code is on a landing page belonging to a business unit of the SFMC instance.


/*Update the unsubscribe from all list*/  
SET @ll_sub = CreateObject("Subscriber")

SetObjectProperty(@ll_sub,"EmailAddress", @SubscriberKey)
SetObjectProperty(@ll_sub,"SubscriberKey", @SubscriberKey)

SET @client = CreateObject("ClientID")
SetObjectProperty(@client, "ID", @memberID)
SetObjectProperty(@client, "IDSpecified", "true")
SetObjectProperty(@ll_sub, "Client", @client)

SetObjectProperty(@ll_sub,"Status", @Unsub_All)
Set @options = CreateObject("UpdateOptions")
Set @save = CreateObject("SaveOption")
AddObjectArrayItem(@options,"SaveOptions", @save)

/* Here is where we actually update the Subscriber object */
Set @update_sub = InvokeUpdate(@ll_sub, @update_sub_status, @update_sub_errorcode, @options)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .