private string GetWebFormMetadataRecordName(Entity entity)
        {
            string          recordName = string.Empty;
            OptionSetValue  type       = entity.GetAttributeValue <OptionSetValue>("adx_type");
            EntityReference webForm    = entity.GetAttributeValue <EntityReference>("adx_webformid");

            if (type != null && webForm != null)
            {
                //switch ((Enums.WebFormMetadata_Type)type)
                //{
                //    case    type.
                //    default:
                //        break;
                //}
                Enums.WebFormMetadata_Type typeEnum = (Enums.WebFormMetadata_Type)type.Value;
                string webFormName = webForm.Name;
                recordName = string.Format("{0} - {1}", webFormName, type.ToString());
            }
            return(recordName);
        }
示例#2
0
        public void TestActionParts()
        {
            using (var context = new Xrm(orgAdminUIService))
            {
                var stringInput   = "A string";
                var datetimeInput = DateTime.Now;
                var boolInput     = true;
                var decimalInput  = 12.3m;
                var floatInput    = 412.2f;
                var intInput      = 12;
                var moneyInput    = new Money(123.7m);
                var pickListInput = new OptionSetValue(3);

                var entity = new Contact();
                entity.Id = orgAdminUIService.Create(entity);

                var req = new OrganizationRequest("Full action");
                req["StringInput"] = stringInput;
                req["Target"]      = entity.ToEntityReference();
                var resp = orgAdminUIService.Execute(req);
                Assert.True(resp.Results.ContainsKey("Output"));
                var output = resp["Output"] as string;
                Assert.Equal(stringInput, output);

                req = new OrganizationRequest("Full action");
                req["DateTimeInput"] = datetimeInput;
                req["Target"]        = entity.ToEntityReference();
                resp = orgAdminUIService.Execute(req);
                Assert.True(resp.Results.ContainsKey("Output"));
                output = resp["Output"] as string;
                Assert.Equal(datetimeInput.ToString(), output);

                req = new OrganizationRequest("Full action");
                req["BoolInput"] = boolInput;
                req["Target"]    = entity.ToEntityReference();
                resp             = orgAdminUIService.Execute(req);
                Assert.True(resp.Results.ContainsKey("Output"));
                output = resp["Output"] as string;
                Assert.Equal(boolInput.ToString(), output);

                req = new OrganizationRequest("Full action");
                req["DecimalInput"] = decimalInput;
                req["Target"]       = entity.ToEntityReference();
                resp = orgAdminUIService.Execute(req);
                Assert.True(resp.Results.ContainsKey("Output"));
                output = resp["Output"] as string;
                Assert.Equal(decimalInput.ToString(), output);

                req = new OrganizationRequest("Full action");
                req["FloatInput"] = floatInput;
                req["Target"]     = entity.ToEntityReference();
                resp = orgAdminUIService.Execute(req);
                Assert.True(resp.Results.ContainsKey("Output"));
                output = resp["Output"] as string;
                Assert.Equal(floatInput.ToString(), output);

                req = new OrganizationRequest("Full action");
                req["IntegerInput"] = intInput;
                req["Target"]       = entity.ToEntityReference();
                resp = orgAdminUIService.Execute(req);
                Assert.True(resp.Results.ContainsKey("Output"));
                output = resp["Output"] as string;
                Assert.Equal(intInput.ToString(), output);

                req = new OrganizationRequest("Full action");
                req["PicklistInput"] = pickListInput;
                req["Target"]        = entity.ToEntityReference();
                resp = orgAdminUIService.Execute(req);
                Assert.True(resp.Results.ContainsKey("Output"));
                output = resp["Output"] as string;
                Assert.Equal(pickListInput.ToString(), output);
            }
        }