You need to sign in to do that
Don't have an account?

Webform To Upsert Leads Using AmpScript;
Hi all not sure if this is the right place to post ampscript help. I have a web formthat is embeded into out website. The form has Name, Email and Phone. I'm tryign to replace phone with or Lead Field Mobile. The field name in Leads is MobilePhone. I get a 500 erro when I change this. In both createSalesforceObject/UpdateSingleSalesforceObject () I've tried ("MobilePhone", @MobilePhone ) AND ("Mobile", "@Mobile") and ("MobilePhone", "@Mobile").
%%[ set @post = QueryParameter("p") set @Email = QueryParameter("emailaddress") set @FirstName = QueryParameter("firstname") set @LastName = QueryParameter("lastname") set @Phone = QueryParameter("phone") set @Email_Opt_in = QueryParameter("Email_Opt_in") set @SubmitDate = QueryParameter("SubmitDate") If @post == "y" then set @web = RetrieveSalesforceObjects("Lead", "Id", "Email", "=", @email) if RowCount(@web) == 0 then CreateSalesforceObject("Lead", 5, "FirstName", @FirstName ,"LastName", @LastName, "Email",@Email,"Status","Open", "MobilePhone", @Phone) else row Set @row = ROW(@web,1) Set @Id = FIELD(@row,"Id") UpdateSingleSalesforceObject("Lead",@id,"FirstName", @FirstName, "LastName", @LastName, "MobilePhone", @Phone) endif UpsertData("BookTour_Form", 1, "Email", @Email, "FirstName", @FirstName, "LastName", @LastName, "SubmitDate", @SubmitDate) var @emailaddr,@attr, @ts, @tsDef, @ts_subkey, @ts_sub, @ts_statusCode, @errorCode SET @ts = CreateObject("TriggeredSend") SET @tsDef = CreateObject("TriggeredSendDefinition") SetObjectProperty(@tsDef, "CustomerKey", "Additional_Tour_Info_Trigger") SetObjectProperty(@ts, "TriggeredSendDefinition", @tsDef) SET @ts_sub = CreateObject("Subscriber") SetObjectProperty(@ts_sub, "EmailAddress", @Email) SetObjectProperty(@ts_sub, "SubscriberKey", @Email) SET @attr = CreateObject("Attribute") SetObjectProperty(@attr, "Name", "FirstName") SetObjectProperty(@attr, "Value", @FirstName) AddObjectArrayItem(@ts_sub, "Attributes", @attr) SET @attr = CreateObject("Attribute") SetObjectProperty(@attr, "Name", "LastName") SetObjectProperty(@attr, "Value", @LastName) AddObjectArrayItem(@ts_sub, "Attributes", @attr) AddObjectArrayItem(@ts, "Subscribers", @ts_sub) SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode) EndIf ]%% %%[If @post == "y" then redirect("http://www.durhamcollege.ca/book-campus-tour") Else]%% <form action="http://pub.info-durhamcollege.ca/Booktour" method="POST" target='_parent'> <input type="hidden" id="p" name="p" value="y"> <input type="hidden" id="rid" name="rid" value = "%%=v(@Id)=%%" /> <input type="hidden" id="SubmitDate" name="SubmitDate" value="%%=Now()=%%"> <table> <tr> <td>First Name </td> <tr> <td> <input type="text" id="firstname" name="firstname" /> </td> </tr> <tr> <td>Last Name* </td> </tr> <tr> <td> <input type="text" id="lastname" name = "lastname" required /> </td> </tr> <tr> <td>Email* </td> <tr> <td> <input type="email" id="emailaddress" name = "emailaddress" required/> </td> </tr> <tr> <td>Mobile Phone* </td> <tr> <td> <input type="tel" id="mobilephone" name = "mobilephone" required/> </td> </tr> <tr> <td> <input type="checkbox" name="Email_Opt_in" id="Email_Opt_in" value="True"> Durham College values the opportunity to provide you with information. Please click here to allow us to continue to contact you via email. </td> </tr> </table> <input type="submit" value="Submit"> </form> %%[ endif ]%%


This has been solved I was using the right field name @MobilePhone but I also had to add a new field for this in my MC Data Extention now it works fine