private void DoActionsOnPostAccount(Customer customer) { if (customer == null) { return; } var accounts = GetAccountsBySourceSystemId(customer.CustomerIdentifier.CustomerId); if (accounts != null) { if (accounts.Entities.Count > 0) { payloadCustomer.Response = new XrmUpdateResponse() { Existing = true, Create = false, Id = null }; return; } } var account = AccountHelper.GetAccountEntityForCustomerPayload(customer, trace); var xrmResponse = CommonXrm.CreateEntity(account, crmService); payloadCustomer.CustomerId = xrmResponse.Id; payloadCustomer.Response = new XrmUpdateResponse() { Existing = false, Create = xrmResponse.Create, Id = xrmResponse.Id }; }
/// <summary> /// To create Feedback records /// </summary> /// <param name="answersToCreate"></param> /// <param name="surveyId"></param> private void CreateFeedback(List <Answer> answersToCreate, Guid surveyId) { trace.Trace("Processing CreateFeedback - start"); if (answersToCreate == null || answersToCreate.Count == 0 || surveyId == Guid.Empty) { return; } for (int i = 0; i < answersToCreate.Count; i++) { var feedbackEntity = AnswerHelper.GetFeedbackEntityFromPayload(answersToCreate[i], payloadSurvey.Trace); feedbackEntity.Attributes[Attributes.SurveyResponseFeedback.SurveyFeedbackId] = new EntityReference(EntityName.SurveyResponse, surveyId); CommonXrm.CreateEntity(feedbackEntity, payloadSurvey.CrmService); } trace.Trace("Processing CreateFeedback - end"); }
/// <summary> /// To create survey feedback record /// </summary> /// <param name="surveyResponse"></param> private void CreateSurveyFeedback(Entity surveyResponse) { trace.Trace("Processing CreateSurveyFeedback - start"); CommonXrm.CreateEntity(surveyResponse, payloadSurvey.CrmService); trace.Trace("Processing CreateSurveyFeedback - end"); }