I’ve a unique requirement from my client. I need to create new Wordpress users when a new Case or Contact is created in the CRM.
I’ve written custom script to create the WP users. Now I need this script to be triggered when a new case or contact is created in the crm. Also I want to send several fields from the CRM to this script.
One way I thought was to create a cron job to query the DB(every hour) and find if there are new entries in the Cases and Contact table. Are there any better ways to trigger a script when a new Case or Contact is created?
I had a similar requirement… Specifically with creating Wordpress users. Here’s how I accomplished it.
1.) I wrote my script as a Wordpress plugin. It’s triggered by a shortcode.
2.) I embedded the shortcode into a Wordpress page.
3.) (Bonus points!) I created a custom Wordpress page template that pulled in NO theme elements. It’s literally a blank page that displays script output.
4.) About once every 10 minutes the SuiteCRM scheduler triggers the script by calling the URL.
I’ve connected my custom WP scripts to Suite using the API. (Here’s the wrapper: https://github.com/asakusuma/SugarCRM-REST-API-Wrapper-Class). Basically I have a custom checkbox field. The script looks for contacts that don’t have that field checked. Once it processes them, it updates the contact by checking the box. (So it’s boolean flag).
Does all of that make sense? I’m not saying it’s the best solution. It’s just how I accomplished it. Basically I got SUPER comfy with the Suite API and did most of the heavy lifing that way.