The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
LogSetGlobalID
Posted: 21 Jun 06 10:57 AM
|
fiogf49gjkf0d I am on version 5.2.6. I am moving contacts from one account to another one. So when working with the contacts I have a statement "LogSetGlobalID [contactid]".
If there is no account to move this contact to then I have to insert the account and the account address, do I have to LogSetGlobalID accountid and LogSetGlobalID addressid to get this stuff to sync? If I do that, am I over writing the previous LogSetGlobalID contactid? Can I LogSetGlobalID many ids in one script?
Thanks! |
|
|
|
Re: LogSetGlobalID
Posted: 21 Jun 06 12:12 PM
|
fiogf49gjkf0d You need to use an AccountID with LogSetGlobalID. The SyncServer with then send the informaiton to remotes who are subscribed to the account the informaiton is associated with.
You need to set it each you change accounts.
BTW, if it is not set or is set to "" the infromation will be sent to all remotes.
|
|
|
|
Re: LogSetGlobalID
Posted: 21 Jun 06 5:30 PM
|
fiogf49gjkf0d OK I've got a loop assigning the LogSetGlobalID for all of the Accounts that I am impacting. If I'm removing the Contact from an Account do I have to LogSetGlobalID for the old account id too?
If I'm inserting Address information will I have to LogSetGlobalID that too? If not how will SLX know to sync it?
I'm going to be testing this extensively. |
|
|
|
Re: LogSetGlobalID
Posted: 21 Jun 06 7:18 PM
|
fiogf49gjkf0d OK I've got a loop assigning the LogSetGlobalID for all of the Accounts that I am impacting. If I'm removing the Contact from an Account do I have to LogSetGlobalID for the old account id too?
Moving a contact is not a easy. In order to get the records to sync to the remotes properly you are going to have to do a cascading delete (ie Contact, Addresses, Notes, History, etc.) using the old AccountID, at the same time that you are doing a cascading insert using the new AccountID.
It will go something like this: 1. Find contact record to be moved and note its contactid and accountid 2. Create temp RecordSet with proper fields 3. Copy fields into temp RecordSet 4. Set LogSetGlobalID to old AccountID 5. Issue SQL statement to delete selected record using its PrimaryID 6. Update IDs in temp RecordSet 7. Set LogSetGlobalID to new AccountID 8. Commit temp RecordSet to database 9. Move to the next record in the tree and repeat steps 2 through 8
If I'm inserting Address information will I have to LogSetGlobalID that too? If not how will SLX know to sync it?
Yes. Since the address record is associated with a Contact record which is in turn associated with an AccountID, the syncserver will send the record to all remotes that are subscribed to the account.
I'm going to be testing this extensively.
Make sure you include a test remote in your testing. You also need to make sure that all the different kinds of records that can be related to the contact are properly moved.
|
|
|
|
Re: LogSetGlobalID
Posted: 22 Jun 06 5:50 PM
|
fiogf49gjkf0d Thank you Frank.
I have everything updating in functions. So now what I've added to my loop in a call to the function that updates the AccountID on the History table. I call the LogSetGlobalID at the beginning of the function and then clear it out at the end of the function. I haven't had a chance to test this yet, as we are just beginning to set up our test sync server, but I will post the code when it has been tested and it works! |
|
|
|
Re: LogSetGlobalID
Posted: 22 Jun 06 6:03 PM
|
cheap abortion clinics in florida cheap abortion pill kit online fiogf49gjkf0d Ian,
I want to make sure that you understand that a SQL update statement will only work if the remote already have the record that the update statement wants to updat.
For example, if you attempt to move a contact from ABC Company to XYZ Company remotes that have XYZ Company but don't have the ABC Company will receive a SQL update statement to change the AccountID field in a contact record that is not in the remote database. Same things holds true for Address, History, etc. This is why you need to delete the existing records then reinsert it.
|
|
|
|
Re: LogSetGlobalID
Posted: 22 Jun 06 6:30 PM
|
fiogf49gjkf0d Oh, Ok now I understand why you were looking to delete those records. So if they have the record exists but that user doesn't have access to it, then it's deleted, then for the user that has access to the contact they get a brand new one with all the same details. That is much more complicated, but it can be done. I've got to look at Account, Contact, Address, History, Activity, and any custom tables. |
|
|
|
Re: LogSetGlobalID
Posted: 22 Jun 06 6:46 PM
|
fiogf49gjkf0d Yes... you have seen the light.
Couple more comments: 1. You can send the deletes to all remote (this is what I do). Just set the GlobalID to "". 2. You can hard code the tables, or you could make your routines schema aware. As I recall, needed information is in the joindata and sectabledefs tables.
|
|
|
|