You could set a series of varialbles $address, $city, $state, etc. Then go to the spouses record and set the fields using those variables.
Or you could have a separate address table with an address ID field in the contacts table and just set the spouse's addressID to the same as the contact's addressID.
I may be being slow with this,
But if I set those variables then it will change every contact?
Assuming I am being slow, then will it just automatically change a contacts details that has been inputed into a spouse field, and then any other contact will remain as a standard contact and will be populated in the usal way?
If this is the case, because I really don't know what I am doing, could you possibly put the both into a step by step process for me?
From the spouse's record that does not have the address info.
Go To related record // the originial contact with the address info
Set Variable $street [Contact::street]
Set Variable $city [Contact::city] //and so on for each field you want
Go to related record // back to the spouse with out the info
Set Field [Contact::street ; $street]
Set Field [Contact::city ; $city] //and so on
The variables only last for the duration of the script, so it will only change the contact that you run the script from. If you do not run the script, you will be able to add info as you normally would and can even change it if needed after you run the script.
Sorry I just tried to do this and couldn't get it to look like you have done.
I don't understand how to work scripts, how do i set the related record?
you don't "set" the related record. The command Go To Related Record goes to records that are related to the current record, so it you were looking at Mary Jones' record and she had John Jones' ContactID as her SpouseID. It would go to his record, get the info, then go back to Mary's record and set her fields.
So I have inputted the script (I have attached a screenshot of it - just incase I have doen it wrong)
And when I navigate from the primary contact to the spouse - through a related contact script - and then run the script it doesn't work and I don't know why?
Any help would be muchly appreciatted
What record are you on when the script completes?
Do you see the expected records or an empty found set?
so I start out on the spouse record
then hit the script and it appears to do nothing
I tested it by adding a variable for the primary records id to then populated into a field on the secondary (spouse) record marked as spouse id so that the link is on both sides. but when running the script it just takes the secondary contacts id and populates it into the spouse id field.
so its seems that it is unable to recognise the linked contact
Say Mary and John are married, you have all the address data entered for John and you want to populate Mary's record. Is John's contactID in Mary's spouseID field and vice versa? The script will not work if that is not the case. If Mary's spouseID field is blank, then there is no related record to goto in the first script step, and if Johns spouseID is blank it will not go to Mary's record in the second Go To Related Record step.
You could add a set variable step before the first Go To related step to capture Mary's ID, then when you go to John's record set his spouseID to that value to automate that action. But you would need to enter John's contactID into Mary's spouseID prior to running the script.
yeah so I have it set that for the following:
Primary contact selects spouse id in there layout
hit button next to spouse id to go to related contact (spouse id)
when in related contact (secondary contact/spouse) I populate the spouse id field with the primary contact id
I then hit a button that runs the above script to populate primary contacts details into secondary contact fields
This isn't working
do you have FM advanced or FM pro. If you have FM advanced you can use the script debugger and Data viewer to see where the script is not behaving.
If you have FM pro you can insert a show custom dialog script step after the set varialbe steps and have it show the variable values in the dialog box to see if they are being set correctly.
I have FM Pro
Will give it a go now, how will i tell what it's doing wrong?
Note what values, if any, there are for the variables and that the script is going back and forth between the two records.