You are here

You are here

Finding and Creating Folders Associated with Salesforce Objects

Salesforce/SpringCM Object Folder

Each time an object is visited within Salesforce that contains the SpringCM File It application a SpringCM folder is created. The folder name and path depend on the SpringCM Setup configuration within Salesforce. This method provides a way to find or create a folder for a Salesforce object. The required information for this call includes:

  • Authentication Token
  • Object Id - This is the 18 digit Salesforce object Id
  • Object Type - This will always include the Salesforce prefix followed by the API Name of the Salesforce object (ex. Salesforce.Account or Salesforce.Custom_Object__c)
  • Folder Name - This is typically the name of the Salesforce object but it can be anything configured on the SpringCM setup tab.
  • Folder Path -  The folder path desired or configured in the SpringCM setup tab.
  • Load Extended Metadata - boolean that determines whether to lead the folder metadata array

The result of this call will be an SCMFolder. This folder will contain a system generated Attribute group called 'Spring External Object Reference', which contains two field, 'Object Id' and 'Object Type'. The values for this attribute fields come directly from the information passed above.

SpringCM Utilities Apex Class

If you have the SpringCM Salesforce package installed in your Salesforce account and you are calling this method from Apex, there is an Apex classes included in the package that can determine the folder name and folder path parameters. This method requires the object Salesforce ID and object API Name. Either the 15 digit or 18 digit Id can be passed but it will always return the 18 digit Id.

Do not confuse the FindOrCreateEOSFolder call with the FindOrCreateSalesforceFolder call.  The FindOrCreateSalesforceFolder was built for an earlier version of SpringCM’s managed package for Salesforce and is now deprecated.  FindOrCreateEOSFolder should be used for any new integration work.

Vertical Tabs

java
SpringCMEos.SpringCMUtilities.EosObject resultObj = SpringCMEos.SpringCMUtilities.createEOSObject('[001E000000LR2v5]','[Account]');
	string sfType = 'Salesforce.' + resultObj.getSfType();
	string sfId = resultObj.getSfId();
	string path = resultObj.getPath();
	string folderName =  resultObj.getFoldername();
 
	springCMSF.SCMFolder eosFolder = service.FindOrCreateEOSFolder(token, sfId , sfType + , folderName, path, true);
	for (springCMSF.SCMMetadata meta : eosFolder.Metadata.SCMMetadata)
	{	
		if (meta.GroupName == 'Spring External Object Reference')
		{
			if (meta.FieldName == 'Object Id')
			{
				System.debug('EOS object Id ' + meta.Value);	
			}
			if (meta.FieldName == 'Object Type')
			{
				System.debug('EOS object Type ' + meta.Value);
			}
 
		}