示例#1
0
        private EntityCollection GetSiblingRules(IOrganizationService service, ITracingService tracingService, Guid parentId, BusinessRuleParentType parentType)
        {
            try
            {
                string targetEntityAttribute = (parentType == BusinessRuleParentType.EntityForm ? "t365_entityform" : "t365_webformstep");

                QueryExpression query = new QueryExpression(PORTAL_BUSINESS_RULE_LOGICAL_NAME);
                query.ColumnSet = new ColumnSet("statuscode", "t365_portalbusinessruleid", "t365_autogeneratedjavascript", "t365_operand1", "t365_operand2", "t365_operator", "t365_entityname", "t365_positiveactionsjson", "t365_negativeactionsjson", "t365_name");
                query.Criteria.AddCondition(targetEntityAttribute, ConditionOperator.Equal, parentId);     // only sibling rules
                query.Criteria.AddCondition("statuscode", ConditionOperator.Equal, RULE_PUBLISHED_STATUS); // only published rules
                EntityCollection results = service.RetrieveMultiple(query);
                return(results);
            }
            catch (InvalidPluginExecutionException pex)
            {
                throw pex;
            }
        }
示例#2
0
 private void ModifyTargetCustomJS(IOrganizationService service, ITracingService tracingService, string cleanedCustomJS, Entity targetEntityFormOrWebFormStep, BusinessRuleParentType parentType, string documentJS)
 {
     if (targetEntityFormOrWebFormStep != null)
     {
         try
         {
             tracingService.Trace("ModifyTargetCustomJS");
             cleanedCustomJS = CleanExistingCustomJS(tracingService, cleanedCustomJS);
             targetEntityFormOrWebFormStep.Attributes[CUSTOM_JS_FIELD_NAME] = cleanedCustomJS.TrimStart() + documentJS;
             service.Update(targetEntityFormOrWebFormStep);
         }
         catch (InvalidPluginExecutionException pex)
         {
             throw pex;
         }
     }
 }