Loading
Índice de materias
Seleccionar filtros

          No hay resultados
          No hay resultados
          Estas son algunas sugerencias de búsqueda

          Compruebe la ortografía de sus palabras clave.
          Utilice términos de búsqueda más generales.
          Seleccione menos filtros para ampliar su búsqueda.

          Buscar en toda la Ayuda de Salesforce
          Anonymous Apex and JavaScript (Managed Package)

          Anonymous Apex and JavaScript (Managed Package)

          For the managed package runtime, review considerations and guidelines for using the Omnistudio Build Tool with Anonymous Apex and JavaScript.

          Managed Package app icon This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.

          To make Anonymous Apex reusable, and write utility files that can be reused, include multiple Apex files with //include FileName.cls; in your .cls file. The BaseUtilities.cls file includes a feature that sends the data as a JSON to your Anonymous Apex.

          Namespace

          In Anonymous Apex, vlocity_namespace is replaced with the vlocity.namespace from the property file.

          Loading Apex Code

          Load Apex code relative to the project path or with an absolute path.

          BaseUtilities.cls

          The tokens CURRENT_DATA_PACKS_CONTEXT_DATA are replaced with JSON data and converted into a List<Map<String, Object>> with data depending on the type of setting and type of job being run.

          List<Object> dataSetObjects = (List<Object>)JSON.deserializeUntyped('CURRENT_DATA_PACKS_CONTEXT_DATA');
          
          List<Map<String, Object>> dataPackDataSet = new List<Map<String, Object>>();
          
          for (Object obj : dataSetObjects)
          {
            if (obj != null)
            {
              dataPackDataSet.add((Map<String, Object>)obj);
            }
          }
          

          PreJobApex

          PreJob Apex can run Anonymous Apex before the data pack Job starts. While it is possible to use CURRENT_DATA_PACKS_CONTEXT_DATA, large projects are over the 32000 character limit for Anonymous Apex.

          preJobApex vs preStepApex

          preStepApex sends only the data pack context data for the currently running API call. For deployments, instead of deactivating all templates and layouts for an entire project before beginning a full deploy, using the same provided DeactivateTemplatesAndLayouts.cls as preStepApex, the target Salesforce org is minimally impacted because each template or Flexcard is deactivated only while it’s being deployed. For best results, combine with the maximumDeployCount of 1.

          postStepApex can be used to run any compilation steps in Apex that are not automatically run inside triggers. EPCProductJSONUpdate.cls is recommended to be run when Deploying Products.

          Pre and Post Job JavaScript

          Like Pre and Post Job Apex you can also run JavaScript against the project with the preJobJavaScript, postJobJavaScript in your job file.

          Your JavaScript file should implement:

          /**
           * 
           * @param {object} vlocity - This is the vlocity.js object. You can use vlocity.jsForceConnection for access to the current JSForce Session.
           * 
           * @param {object} currentContextData - For preJobJavaScript this is null. For postJobJavaScript this will be a full list of records processed during the job.
           * 
           * @param {object} jobInfo - This is the entire job state
           * 
           * @param {function} callback - Callback - Must be called
           */ 
          
          module.exports = function(vlocity, currentContextData, jobInfo, callback) {
            // Your Code Here
          });
          

          For a Query, each result from the Query is a JSON Object with the appropriate data pack type.

          queries: 
            - VlocityDataPackType: VlocityUITemplate 
              query: Select Id from %vlocity_namespace%__VlocityUITemplate__c where Name LIKE 'campaign%'
          

          becomes

          {
              "VlocityDataPackType": "VlocityUITemplate",
              "Id": "01r61000000DeTeAAN",
          }
          

          Before a deploy, each JSON object stores a small amount of information about the object. By default, the name of the object. For a VlocityUILayout it would look like this example:

          {
              "VlocityDataPackType": "VlocityUILayout",
              "Name": "Campaign-Story"
          }
          

          In the DeactivateTemplatesAndLayouts.cls this name is used to deactivate the layouts that are pending for deployment.

          PostJobApex Replacement Format

          Post Job Apex runs after the Job completes successfully.

          After a deployment, the Ids of every deployed record are in the JSON object list. For large deployments, this volume can be too much data for Anonymous Apex.

          {
              "Id": "01r61000000DeTeAAN"
          }
          
           
          Cargando
          Salesforce Help | Article