protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"
            String inputText = this.InputText.Get(executionContext);
            if (inputText == null)
            {
                inputText = "";
            }
            bool capitalizeAllWords = this.CapitalizeAllWords.Get(executionContext);

            string padCharacter           = this.PadCharacter.Get(executionContext);
            bool   padontheLeft           = this.PadontheLeft.Get(executionContext);
            int    finalLengthwithPadding = this.FinalLengthwithPadding.Get(executionContext);

            string replaceOldValue = this.ReplaceOldValue.Get(executionContext);
            string replaceNewValue = this.ReplaceNewValue.Get(executionContext);
            if (replaceNewValue == null)
            {
                replaceNewValue = "";
            }
            bool caseSensitive = this.CaseSensitive.Get(executionContext);

            bool   fromLefttoRight   = this.FromLefttoRight.Get(executionContext);
            int    startIndex        = this.StartIndex.Get(executionContext);
            int    subStringLength   = this.SubStringLength.Get(executionContext);
            string regularExpression = this.RegularExpression.Get(executionContext);

            #endregion

            string capitalizedText = "", paddedText = "", replacedText = "", subStringText = "", regexText = "", uppercaseText = "", lowercaseText = "";
            bool   regexSuccess  = false;
            string withoutSpaces = "";
            msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service, objCommon.tracingService);
            bool test = commonClass.StringFunctions(capitalizeAllWords, inputText, padCharacter, padontheLeft, finalLengthwithPadding, caseSensitive,
                                                    replaceOldValue, replaceNewValue, subStringLength, startIndex, fromLefttoRight, regularExpression,
                                                    ref capitalizedText, ref paddedText, ref replacedText, ref subStringText, ref regexText,
                                                    ref uppercaseText, ref lowercaseText, ref regexSuccess, ref withoutSpaces);



            this.CapitalizedText.Set(executionContext, capitalizedText);
            this.TextLength.Set(executionContext, capitalizedText.Length);
            this.PaddedText.Set(executionContext, paddedText);
            this.ReplacedText.Set(executionContext, replacedText);
            this.SubstringText.Set(executionContext, subStringText);
            this.TrimmedText.Set(executionContext, inputText.Trim());
            this.RegexSuccess.Set(executionContext, regexSuccess);
            this.RegexText.Set(executionContext, regexText);

            this.UppercaseText.Set(executionContext, uppercaseText);
            this.LowercaseText.Set(executionContext, lowercaseText);

            this.WithoutSpaces.Set(executionContext, withoutSpaces);
        }
Пример #2
0
        //string relationshipName, string parentFieldNameToUpdate, string setValueToUpdate, string childFieldNameToUpdate
        //string parentEntityId, string parentEntityType,

        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"
            String _ParentRecordURL = this.ParentRecordURL.Get(executionContext);
            if (_ParentRecordURL == null || _ParentRecordURL == "")
            {
                return;
            }
            string[] urlParts         = _ParentRecordURL.Split("?".ToArray());
            string[] urlParams        = urlParts[1].Split("&".ToCharArray());
            string   objectTypeCode   = urlParams[0].Replace("etc=", "");
            string   parentEntityType = objCommon.sGetEntityNameFromCode(objectTypeCode, objCommon.service);
            string   parentEntityId   = urlParams[1].Replace("id=", "");
            objCommon.tracingService.Trace("ObjectTypeCode=" + objectTypeCode + "--ParentId=" + parentEntityId);

            String _RelationshipName        = this.RelationshipName.Get(executionContext);
            String _ParentFieldNameToUpdate = this.ParentFieldNameToUpdate.Get(executionContext);
            String _ValueToSet             = this.ValueToSet.Get(executionContext);
            String _ChildFieldNameToUpdate = this.ChildFieldNameToUpdate.Get(executionContext);
            bool   _UpdateonlyActive       = this.UpdateonlyActive.Get(executionContext);

            objCommon.tracingService.Trace("RelationshipName=" + _RelationshipName + "--_ParentFieldNameToUpdate=" + _ParentFieldNameToUpdate);
            objCommon.tracingService.Trace("_ValueToSet=" + _ValueToSet + "--_ChildFieldNameToUpdate=" + _ChildFieldNameToUpdate);
            #endregion

            msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service);
            commonClass.UpdateChildRecords(_RelationshipName, parentEntityType, parentEntityId, _ParentFieldNameToUpdate, _ValueToSet, _ChildFieldNameToUpdate, _UpdateonlyActive);
        }
Пример #3
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"
            String json     = this.JSON.Get(executionContext);
            String jsonPath = this.JSONPath.Get(executionContext);

            #endregion


            msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service, objCommon.tracingService);
            string res = commonClass.JsonParser(json, jsonPath);

            if (res == null)
            {
                res = "";
            }

            this.JSONResult.Set(executionContext, res);
        }
Пример #4
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"
            String _TextToTranslate   = this.TextToTranslate.Get(executionContext);
            String _Language          = this.Language.Get(executionContext);
            String _Authenticationkey = this.Authenticationkey.Get(executionContext);

            #endregion


            msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service, objCommon.tracingService);
            string res = commonClass.TranslateText(_TextToTranslate, _Language, _Authenticationkey);

            if (res == null)
            {
                res = "";
            }

            this.TranslatedText.Set(executionContext, res);
        }
        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"
            String _relationshipName       = this.RelationshipName.Get(executionContext);
            String _relationshipEntityName = this.RelationshipEntityName.Get(executionContext);
            String _recordURL = this.RecordURL.Get(executionContext);
            if (_recordURL == null || _recordURL == "")
            {
                return;
            }
            string[] urlParts             = _recordURL.Split("?".ToArray());
            string[] urlParams            = urlParts[1].Split("&".ToCharArray());
            string   ParentObjectTypeCode = urlParams[0].Replace("etc=", "");
            string   entityName           = objCommon.sGetEntityNameFromCode(ParentObjectTypeCode, objCommon.service);
            string   ParentId             = urlParams[1].Replace("id=", "");
            objCommon.tracingService.Trace("ParentObjectTypeCode=" + ParentObjectTypeCode + "--ParentId=" + ParentId);
            #endregion


            #region "Associate Execution"

            try
            {
                msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service);
                commonClass.AssociateEntity(objCommon.context.PrimaryEntityName, objCommon.context.PrimaryEntityId, _relationshipName, _relationshipEntityName, entityName, ParentId);
            }
            catch (FaultException <OrganizationServiceFault> ex)
            {
                objCommon.tracingService.Trace("Error : {0} - {1}", ex.Message, ex.StackTrace);
                //throw ex;
                // if (ex.Detail.ErrorCode != 2147220937)//ignore if the error is a duplicate insert
                //{
                // throw ex;
                //}
            }
            catch (System.Exception ex)
            {
                objCommon.tracingService.Trace("Error : {0} - {1}", ex.Message, ex.StackTrace);
                //throw ex;
            }
            #endregion
        }
Пример #6
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"
            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"
            String appModuleUniqueName = this.AppModuleUniqueName.Get(executionContext);
            #endregion

            msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service, objCommon.tracingService);

            string appModuleId = commonClass.GetAppModuleId(appModuleUniqueName);

            this.AppModuleId.Set(executionContext, appModuleId);
        }
Пример #7
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"
            bool   _GlobalOptionSet = this.GlobalOptionSet.Get(executionContext);
            String _AttributeName   = this.AttributeName.Get(executionContext);
            String _EntityName      = this.EntityName.Get(executionContext);
            String _OptionText      = this.OptionText.Get(executionContext);
            int    _OptionValue     = this.OptionValue.Get(executionContext);
            int    _LanguageCode    = this.LanguageCode.Get(executionContext);

            objCommon.tracingService.Trace("_AttributeName=" + _AttributeName + "--_EntityName=" + _EntityName + "--_OptionText=" + _OptionText + "--_LanguageCode=" + _LanguageCode.ToString());
            #endregion


            #region "Insert Option Value"

            try
            {
                msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service);
                commonClass.InsertOptionValue(_GlobalOptionSet, _AttributeName, _EntityName, _OptionText, _OptionValue, _LanguageCode);
            }
            catch (FaultException <OrganizationServiceFault> ex)
            {
                objCommon.tracingService.Trace("Error : {0} - {1}", ex.Message, ex.StackTrace);
                //throw ex;
                // if (ex.Detail.ErrorCode != 2147220937)//ignore if the error is a duplicate insert
                //{
                // throw ex;
                //}
            }
            catch (System.Exception ex)
            {
                objCommon.tracingService.Trace("Error : {0} - {1}", ex.Message, ex.StackTrace);
                //throw ex;
            }
            #endregion
        }
Пример #8
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"
            String          _teamName      = this.TeamName.Get(executionContext);
            int             _teamType      = this.TeamType.Get(executionContext);
            EntityReference _administrator = this.Administrator.Get(executionContext);
            EntityReference _businessUnit  = this.BusinessUnit.Get(executionContext);

            objCommon.tracingService.Trace("_teamName=" + _teamName);
            #endregion


            #region "Associate Execution"

            try
            {
                msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service);
                Guid createdTeamId = commonClass.CreateTeam(_teamName, _teamType, _administrator, _businessUnit);
                this.createdTeam.Set(executionContext, new EntityReference("team", createdTeamId));
            }
            catch (FaultException <OrganizationServiceFault> ex)
            {
                objCommon.tracingService.Trace("Error : {0} - {1}", ex.Message, ex.StackTrace);
                //throw ex;
                // if (ex.Detail.ErrorCode != 2147220937)//ignore if the error is a duplicate insert
                //{
                // throw ex;
                //}
            }
            catch (System.Exception ex)
            {
                objCommon.tracingService.Trace("Error : {0} - {1}", ex.Message, ex.StackTrace);
                //throw ex;
            }
            #endregion
        }
Пример #9
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"
            DateTime date1 = this.Date1.Get(executionContext);
            DateTime date2 = this.Date2.Get(executionContext);

            #endregion



            msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service, objCommon.tracingService);
            TimeSpan difference = new TimeSpan();
            int      DayOfWeek  = 0;
            int      DayOfYear  = 0;
            int      Day        = 0;
            int      Month      = 0;
            int      Year       = 0;
            int      WeekOfYear = 0;
            commonClass.DateFunctions(date1, date2, ref difference,
                                      ref DayOfWeek, ref DayOfYear, ref Day, ref Month, ref Year, ref WeekOfYear);


            this.TotalDays.Set(executionContext, difference.TotalDays);
            this.TotalHours.Set(executionContext, difference.TotalHours);
            this.TotalMilliseconds.Set(executionContext, difference.TotalMilliseconds);
            this.TotalMinutes.Set(executionContext, difference.TotalMinutes);
            this.TotalSeconds.Set(executionContext, difference.TotalSeconds);


            this.DayOfWeek.Set(executionContext, DayOfWeek);
            this.DayOfYear.Set(executionContext, DayOfYear);
            this.Day.Set(executionContext, Day);
            this.Month.Set(executionContext, Month);
            this.Year.Set(executionContext, Year);
            this.WeekOfYear.Set(executionContext, WeekOfYear);
        }
Пример #10
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"
            String recordURL = this.RecordURL.Get(executionContext);


            #endregion

            msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service, objCommon.tracingService);
            string recordID = commonClass.GetRecordID(recordURL);


            this.RecordID.Set(executionContext, recordID);
        }
        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"
            EntityReference user = this.User.Get(executionContext);


            #endregion


            msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service, objCommon.tracingService);
            EntityReference             team        = commonClass.retrieveUserBUDefaultTeam(user.Id.ToString());

            this.DefaultTeam.Set(executionContext, team);
        }
        //string relationshipName, string parentFieldNameToUpdate, string setValueToUpdate, string childFieldNameToUpdate
        //string parentEntityId, string parentEntityType,

        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"

            String _functionURL = this.FunctionURL.Get(executionContext);
            String _jsonData    = this.JsonData.Get(executionContext);
            objCommon.tracingService.Trace("FunctionURL:" + _functionURL + " -- JsonData:" + _jsonData);

            #endregion

            msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service);
            string result = commonClass.AzureFunctionCall(_jsonData, _functionURL);

            this.Result.Set(executionContext, result);
        }
Пример #13
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"


            Decimal amount       = this.Amount.Get(executionContext);
            string  fromCurrency = this.FromCurrency.Get(executionContext);
            string  toCurrency   = this.ToCurrency.Get(executionContext);

            #endregion
            msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service, objCommon.tracingService);
            Decimal result = commonClass.CurrencyConvert(amount, fromCurrency, toCurrency);


            this.Result.Set(executionContext, result);
        }
        //string relationshipName, string parentFieldNameToUpdate, string setValueToUpdate, string childFieldNameToUpdate
        //string parentEntityId, string parentEntityType,

        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"

            string _subscriptionKey = this.SubscriptionKey.Get(executionContext);
            string _texttoAnalyze   = this.TexttoAnalyze.Get(executionContext);
            string _language        = this.Language.Get(executionContext);

            objCommon.tracingService.Trace("_subscriptionKey:" + _subscriptionKey + " -- TexttoAnalyze:" + TexttoAnalyze + " -- _language:" + _language);

            #endregion

            msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service);
            string result = commonClass.AzureTextAnalyticsSentiment(_subscriptionKey, _texttoAnalyze, _language);

            this.Result.Set(executionContext, result);
        }
Пример #15
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"

            String _relationshipName = this.RelationshipName.Get(executionContext);
            if (_relationshipName == null || _relationshipName == "")
            {
                return;
            }

            String _newParentFieldName = this.NewParentFieldNameToUpdate.Get(executionContext);
            if (_newParentFieldName == null || _newParentFieldName == "")
            {
                return;
            }

            String _source = this.SourceRecordUrl.Get(executionContext);
            if (_source == null || _source == "")
            {
                return;
            }

            string[] urlParts             = _source.Split("?".ToArray());
            string[] urlParams            = urlParts[1].Split("&".ToCharArray());
            string   parentObjectTypeCode = urlParams[0].Replace("etc=", "");
            string   parentEntityName     = objCommon.sGetEntityNameFromCode(parentObjectTypeCode, objCommon.service);
            string   parentId             = urlParams[1].Replace("id=", "");
            objCommon.tracingService.Trace("ObjectTypeCode=" + parentObjectTypeCode + "--ParentId=" + parentId);

            String _destination = this.TargetRecordUrl.Get(executionContext);
            if (_destination == null || _destination == "")
            {
                return;
            }
            string[] destinationUrlParts       = _destination.Split("?".ToArray());
            string[] destinationUrlParams      = destinationUrlParts[1].Split("&".ToCharArray());
            string   destinationObjectTypeCode = destinationUrlParams[0].Replace("etc=", "");
            string   destinationEntityName     = objCommon.sGetEntityNameFromCode(destinationObjectTypeCode, objCommon.service);
            string   destinationId             = destinationUrlParams[1].Replace("id=", "");
            objCommon.tracingService.Trace("ObjectTypeCode=" + destinationObjectTypeCode + "--ParentId=" + destinationId);


            //Optional
            String _oldParentFieldName = this.OldParentFieldNameToUpdate.Get(executionContext);
            string prefix         = this.Prefix.Get(executionContext);
            string fieldstoIgnore = this.FieldstoIgnore.Get(executionContext);

            #endregion

            var tools = new msdyncrmWorkflowTools_Class(objCommon.service);

            var children = tools.GetChildRecords(_relationshipName, parentId);

            foreach (var item in children.Entities)
            {
                var newRecordId = objCommon.CloneRecord(item.LogicalName, item.Id.ToString(), fieldstoIgnore, prefix);

                Entity update = new Entity(item.LogicalName);
                update.Id = newRecordId;
                update.Attributes.Add(_newParentFieldName, new EntityReference(destinationEntityName, new Guid(destinationId)));
                if (!string.IsNullOrEmpty(_oldParentFieldName) && _oldParentFieldName != _newParentFieldName)
                {
                    update.Attributes.Add(_oldParentFieldName, null);
                }

                objCommon.service.Update(update);
            }
        }
Пример #16
0
        /*  [Input("Image Format")]
         * public InArgument<String> imageFormat { get; set; }*/

        #endregion

        protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"
            String _recordURL = this.RecordURL.Get(executionContext);
            if (_recordURL == null || _recordURL == "")
            {
                return;
            }
            string[] urlParts             = _recordURL.Split("?".ToArray());
            string[] urlParams            = urlParts[1].Split("&".ToCharArray());
            string   ParentObjectTypeCode = urlParams[0].Replace("etc=", "");
            string   entityName           = objCommon.sGetEntityNameFromCode(ParentObjectTypeCode, objCommon.service);
            string   ParentId             = urlParams[1].Replace("id=", "");
            objCommon.tracingService.Trace("ParentObjectTypeCode=" + ParentObjectTypeCode + "--ParentId=" + ParentId);

            string _QRInfo = this.QRInfo.Get(executionContext);
            objCommon.tracingService.Trace("QR Ok");
            string _noteSubject = this.noteSubject.Get(executionContext);
            if (_noteSubject == null || _noteSubject == "")
            {
                _noteSubject = "QR";
            }
            objCommon.tracingService.Trace("noteSubject Ok");

            string _noteText = this.noteText.Get(executionContext);
            objCommon.tracingService.Trace("noteText Ok");

            string _fileName = this.fileName.Get(executionContext);
            objCommon.tracingService.Trace("FileName Ok");

            string _imageFormat = "jpg";//this.imageFormat.Get(executionContext);
            objCommon.tracingService.Trace("ImageFormat Ok");

            if (_imageFormat == null || _imageFormat == "")
            {
                _imageFormat = "jpg";
            }
            if (_fileName == null || _fileName == "")
            {
                _fileName = "QR." + _imageFormat;
            }



            #endregion


            #region "QR Execution"

            try
            {
                objCommon.tracingService.Trace("Start QR Creation");
                msdyncrmWorkflowTools_Class commonClass = new msdyncrmWorkflowTools_Class(objCommon.service, objCommon.tracingService);
                commonClass.QRCode(entityName, ParentId, _QRInfo, _noteSubject, _noteText, _fileName);
            }
            catch (FaultException <OrganizationServiceFault> ex)
            {
                objCommon.tracingService.Trace("Error : {0} - {1}", ex.Message, ex.StackTrace);
                throw ex;
                // if (ex.Detail.ErrorCode != 2147220937)//ignore if the error is a duplicate insert
                //{
                // throw ex;
                //}
            }
            catch (System.Exception ex)
            {
                objCommon.tracingService.Trace("Error : {0} - {1}", ex.Message, ex.StackTrace);
                throw ex;
            }
            #endregion
        }