#127 - Compatibility with 3rd party outlook plugins
I’m running CE v6.5.11 with the security suite module and I’ve installed a couple of 3rd party outlook plugins (SugarArchiver & Opacus SugarCRM Plugin) for synching with sugar. When I create a new record in sugar from outlook (ie archiving email to an account), no security groups get tied to the newly created record. I thought at first maybe it was the plugin, but then installed another one and the same issue arose. I’m using the “Inherit from Parent Record” setting in Security Suite (which works perfectly fine when creating new records in sugar). Let me know if you need more information.
11 years ago
Some 3rd party plugins don't relate the record that gets created to the parent until after save. Which means that the parent isn't there yet when "Inherit from Parent Record" runs. From a SecuritySuite stand point there isn't much we can do on our end. A work around some have done is to create a logic hook for after_relationship_add to add the group to the record if created via that 3rd party plugin.
11 years ago
I just started working with sugar but have used php. What would be the easiest way to test your "relate after save" theory?
11 years ago
I'd start with an before_save hook against the Emails module to see what you get for data being passed. The logic for how to inherit is in modules/SecurityGroups/SecurityGroup.php->inherit_parent. Most likely what it is looking for is not set. If that is the case then you'll need to create an after_relationship_add hook to capture when a contact or account is added to the email record so that the group(s) associated with those records get associated to the email. That would require grabbing those groups in the logic hook and adding them to the email bean.
11 years ago
I dumped the data on the before_save hook and could not find the id for the parent record. I'm guessing that's all we need to confirm it's done at the relationship level?
11 years ago
Yeah, basically that means they are relating the records after save which is outside of what SecuritySuite can safely handle. Would be great if those plugins would do it in a single call. Work around is to create an after_relationship_add hook to handle that manually for that specific use-case.
11 years ago
Since I'm new to sugar and haven't done anything code wise (only admin work), can you give me a little more detail as to what I'll need to do in the after_relationship_add hook?
11 years ago
I'll send you my best guess via email since I don't have access to the plugin. If you get it figured out I just ask that you send me the final solution so that I can add it to the docs here.
11 years ago
Excellent. I'll post back my finding.
11 years ago
Your solution worked without any changes really! I just wrapped the code with a soap.php check on $_SERVER["SCRIPT_NAME"]. Let me know if you still want me to send it back to you. What are the potential side effects to these changes (if any)?
11 years ago
Very cool. Sure, would love to have it on hand at least. Side effect to that logic hook is that it'll process it upon any save. So if you removed a group from an email manually, but then save it will reinherit the group from the account. Almost never an issue, but pointing it out.
11 years ago
Just sent the code to you. Thanks again for you help, really appreciate it.