The GUIDEcx for Salesforce managed package provides default functionality to create pending projects when an opportunity is closed/won. This trigger can be customized to match different criteria on the opportunity. If this is all you need, please refer to the article for managing workflow rules, FOUND HERE.
The advanced functionality of the managed package provides the ability to:
Customize the source object to something other than an Opportunity.
Provide data needed to create a complete project, skipping the pending project stage in GUIDEcx.
Customizing Source Trigger
The following guide will help you customize the default trigger which starts the project creation process once an opportunity is closed/won. This step is only required if you need to change the source object or you want to customize the trigger on the default Opportunity source object. We’re going to be replacing the default workflows and triggers with a custom Apex trigger.
Deactivate the default workflow called “Create beynd Project on Closed Won”. This is the workflow responsible for checking a custom flag on the opportunity when the opportunity is closed/won.
Deactivate both Apex triggers: OpportunityTrigger and GuideCXCreateProjectTrigger.
Create a new Apex Trigger. This trigger will be responsible for implementing your business logic for filtering the source objects. Here is an example Apex trigger based on an Opportunity that you can follow.
The trigger must call `beynd.GuideCXService.createProjects` with the list of source object IDs that meet your business logic criteria. This is the method that kicks off all of the project creation logic in the managed package.
If your source object is anything other than an Opportunity, be sure to follow the guide below for setting up a custom Project Source configuration.
Project Source Data
The following guide will help you create a new Apex conversion class that is used to translate a source object into a valid GUIDEcx project response. By completing this step, you’ll be able to create a complete project in GUIDEcx, skipping the default pending project state. Note: this step is necessary if you’re wanting to customize the project data, even if you’re still planning on using the default opportunity trigger. This step is also required if you’ve modified your triggers to use another source object, other than Opportunity.
We will be creating a new Apex class that implements the `beynd.GuideCXProjectConversion` class provided in the managed package. Refer to this example of a custom conversion class that expects an Opportunity as the source object. There are two methods that must be implemented.
Input: source object ID
This purpose of this method is to prepare an instance of the beynd.GuideCXProject with data from the source object. For a complete list of supported fields, refer to the GuideCXProject Apex Class in your Salesforce setup. You don’t have to provide data for every field, but there are some required fields if you want the project to be considered complete. If any of the required* fields do not have values provided, the notification to GUIDEcx will result in a Pending Project.
CustomFields (Map<CustomFieldId, string>)
CustomerTeamMembers (list Person)
InternalTeamMembers (list Person)
Templates (Set template skus)
setProjectManager: this method is how you set the project manager on the project. The email provided must match the email of an existing account in your GUIDEcx organization, and must have appropriate permissions to be a project manager (Admin, Manager, & Guide, users)
addCustomerTeamMember: these users will be added and receive the project invitation upon project creation.
addInternalTeamMember: these users must already exist in your GUIDEcx organization. Email the primary lookup.
Input: Map<SourceObjectId, GuideCXProjectId>
The purpose of this method is to provide you the ability to link a newly created GUIDEcx project to the source object. This linkage will allow you to run reports from your source object and pull in the related GUIDEcx project, milestones, and tasks. Refer to this example.
Project Source Metadata
Congratulations! You’ve created your custom Source Object Conversion class and now you need to let the the managed package know when to use it. To do this, you’ll need to create a new Metadata record.
Setup > Custom Metadata Types > GUIDEcx Project Source > Manage Records
If Opportunity is still your source, update the default record “Opportunity_Source” to point to a unused source object
Create a new record
Label: descriptive name for your Source Conversion. Ie. CustomGuideCXConversion
GUIDEcx Project Source Name: can keep the autofilled value
Implementation Class: must match the name of the custom Conversion Class you created earlier
Source Object: select the appropriate source object that projects are based on (ie. Opportunity)
And you’re done! You can now start testing your custom configuration from end to end, starting with updating the appropriate source object to invoke your custom trigger, which will notify the managed manage to create projects.
You’ll most likely need to develop any custom Apex code in a Sandbox environment. GUIDEcx supports connections to Salesforce Sandboxes - but these are only intended for testing purposes. Do not run live projects through your Sandbox connection, as they will not transfer to your production Salesforce instance when you switch the connection.
Go to "Company Details" in GUIDEcx (on the bottom-left corner).
Click the "Integrations" tab.
Click the 3 dots on the Salesforce tile.
Click "Connect to sandbox environment".
Fill in your sandbox credentials.
Trigger is running, but nothing happening in the GUIDEcx managed package
Confirm you’ve setup your trigger following the prior guide, paying special attention that you’re calling the beynd.GuideCXService.createProjects method with the list of source object ids.
Empty project is created in Salesforce, but nothing is happening in GUIDEcx
There are some internal services in the managed package which will notify the GUIDEcx API of new projects. We need to confirm that those API calls are being made by inspecting entries in the beynd__BeyndAPIMessage__c object. The manage package will retry failed requests 4 times before stopping and notifying the Salesforce user via email.
No API Messages Found
You’ve inspected the API Messages and found that there haven’t been any requests made to the GUIDEcx API. Next step is to inspect the Debug logs for your user account as well as for the user “Automated Process”. These logs will help identity any unhandled errors in any of the Apex code between your trigger and the service responsible for notifying GUIDEcx of new projects.
Setup > Debug Logs
Create a new trace flag for “Automated Process”
Ensure your user already has a trace flag, and create a new one if needed
Rerun an end to end test of your triggers and conversion class. Wait for the logs and then download. Inspect the logs for any errors related to code preventing code in the `beynd` namespace from being called or completing successfully.
I’ve completed the conversion class setup, but I’m still getting pending projects created in GUIDEcx, not complete projects like I’d expect.
Are you providing values for every required field on the GuideCXProject in your conversion class?
Does the project manager email match a valid Admin, Manager or Guide in your GUIDEcx account?
Have you updated the Custom Metadata Types > GUIDEcx Project Source records to use your new conversion class instead of the default “OpportunityConversion”?
Confirm there aren’t any unhandled errors in your conversion class. Entries in beynd__BeyndAPIMessage__c will also provide some details if there was an error fetching the project data from your conversion class or if there was a missing required field.