AnsweredAssumed Answered

Updating Record via portal

Question asked by user2148443 on Dec 25, 2018
Latest reply on Dec 26, 2018 by comment

I have set up my project with a table for properties, and then via a link table to a table for contacts.

 

I have an issue i am trying to get the properties details to be updated from the contacts in regards to billing email and phone.

 

It works half the way, as the property can have multiple contacts, when i try and update details from a selected contact, it will not update the details. eg i have a setting in the contacts to set a an accountant, however it does not update the records.

Also it seems that it will only use the first record linked from the contacts table to update records. (the first one created from the properties table) the second or third contact linked will not update the records.

 

What i want to do is if the contact_type is set as "accountant" to update the properties A/P Email to the same.

 

here is the script i am currently using but does not update any records other than the first linked record.

Commit Records/Requests [ With dialog: On ]

#

Set Variable [ $$NameFirst ; Value: Contacts::Name_First ]

Set Variable [ $$NameLast ; Value: Contacts::Name_Last ]

Set Variable [ $$Email_AP ; Value: Contacts::Email_AP ]

#

// Close Window [ Current Window ]

#

Go to Related Record [ From table: “TO_002____Customers” ; Using layout: “LO_003_CUSTOMERS_DETAILS” (TO_002____Customers) ]

#

If [ Contacts::Contact_Type = "Site Primary" ]

Set Field [ TO_002____Customers::First ; Contacts::Name_First ]

Set Field [ TO_002____Customers::Last ; Contacts::Name_Last ]

Set Field [ TO_002____Customers::SiteName ; TO_002____Customers::Site Address Number &" " & TO_002____Customers::Site Address 1 &", " & TO_002____Customers::Site City  &" ( "&  TO_002____Customers::First &" "& TO_002____Customers::Last &" )" ]

Set Field [ TO_002____Customers::Contact_Site_Pri_First_Name ; Contacts::Name_First ]

Set Field [ TO_002____Customers::Contact_Site_Pri_Second_Name ; Contacts::Name_Last ]

#

# Set Phone numbers

Set Field [ Contacts::Mobile ; TextFormatRemove ( Contacts::Mobile ) ]

Set Field [ TO_002____Customers::Contact_Site_Pri_Mobile ; Contacts::Mobile ]

Set Field [ TO_002____Customers::Mobile Phone ; Contacts::Mobile ]

Set Field [ Contacts::Phone ; TextFormatRemove ( Contacts::Phone ) ]

Set Field [ TO_002____Customers::Contact_Site_Pri_Phone ; Contacts::Phone ]

Set Field [ TO_002____Customers::Office Phone ; Contacts::Phone ]

#

Set Field [ Contacts::Email ; TextFormatRemove ( Contacts::Email ) ]

Set Field [ TO_002____Customers::Contact_Site_Pri_Email ; Contacts::Email ]

If [ Contacts::Billing Contact = "Yes" ]

Set Field [ TO_002____Customers::Office Email ; Contacts::Email_AP ]

End If

// #

// #

// Else If [ Contacts::Contact_Type = "Accountant" ]

Else

If [ Contacts::Contact_Type = "Accountant" ]

Set Field [ TO_002____Customers::Office Email ; Contacts::Email_AP ]

End If

// If [ Contacts::Billing Contact = "Yes" ]

// Set Field [ TO_002____Customers::Office Email ; Contacts::Email_AP ]

End If

#

Outcomes