使用 Web API 获取新创建的 Activity NoteID
Get newly created Activity NoteID using Web API
我正在使用 Web API 将机会活动推送到使用屏幕 ID SP303020 的 Acumatica 合作伙伴门户。我需要从 Acumatica 合作伙伴门户获取新创建的 NoteID,它是 CRActivity table 中的唯一标识符,并存储到我的数据库中,这样我就不会再次推送相同的机会活动并创建重复项。
这是我用来获取新创建的机会的代码 Activity NoteID,但我没有得到任何东西
SP303020WS.Screen context = new SP303020WS.Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.AllowAutoRedirect = true;
context.EnableDecompression = true;
context.Timeout = 1000000;
context.Url = "https://sso.acumatica.com/Soap/SP303020.asmx";
SP303020WS.LoginResult result = context.Login(username, password);
SP303020WS.Content CR303020 = context.GetSchema();
context.Clear();
#region Push Activity to Partners Portal
SP303020WS.Content[] CR303020Content = context.Submit
(
new SP303020WS.Command[]
{
new SP303020WS.Value
{
Value = actiPartner.AcumaticaCaseID,
LinkedCommand = CR303020.Opportunity.OpportunityID
},
new SP303020WS.Value
{
Value = actiType,
LinkedCommand = CR303020.Activities.Type
},
new SP303020WS.Value
{
Value = actiCloud9.Subject,
LinkedCommand = CR303020.Activities.Summary
},
new SP303020WS.Value
{
Value = actiCloud9.Body,
LinkedCommand = new SP303020WS.Field { FieldName="Body", ObjectName="Activities"}
},
new SP303020WS.Value
{
Value = actiCloud9.StartDate.ToString(),
LinkedCommand = CR303020.Activities.StartDate
},
CR303020.Activities.ServiceCommands.NewRow,
CR303020.Actions.Save
}
);
#endregion
#region Getting Newly created Opportunity Activity NoteID
SP303020WS.Screen s2 = new SP303020WS.Screen();
s2.CookieContainer = context.CookieContainer;
SP303020WS.Content schema2 = s2.GetSchema();
var commands1 = new SP303020WS.Command[]
{
schema2.Opportunity.OpportunityID,
new SP303020WS.Field { FieldName="NoteID", ObjectName="Activities"},
};
var data = s2.Submit(commands1);
#endregion
请检查下面的代码片段:
SP303020.Screen context = new SP303020.Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.Url = "https://sso.acumatica.com/Soap/SP303020.asmx";
SP303020.LoginResult result = context.Login("***", "***");
SP303020.Content CR303020 = context.GetSchema();
var origActivities = context.Export
(
new SP303020.Command[]
{
new SP303020.Value
{
Value = "OP00013116",
LinkedCommand = CR303020.Opportunity.OpportunityID
},
CR303020.Activities.Type,
CR303020.Activities.Summary,
new SP303020.Field
{
FieldName = "NoteID",
ObjectName = CR303020.Activities.Summary.ObjectName
}
},
null, 0, false, false);
SP303020.Content[] CR303020Content = context.Submit
(
new SP303020.Command[]
{
new SP303020.Value
{
Value = "OP00013116",
LinkedCommand = CR303020.Opportunity.OpportunityID
},
CR303020.Activities.ServiceCommands.NewRow,
new SP303020.Value
{
Value = "Note",
LinkedCommand = CR303020.Activities.Type
},
new SP303020.Value
{
Value = "Test Note 3",
LinkedCommand = CR303020.Activities.Summary
},
CR303020.Actions.Save
}
);
var activities = context.Export
(
new SP303020.Command[]
{
new SP303020.Value
{
Value = "OP00013116",
LinkedCommand = CR303020.Opportunity.OpportunityID
},
CR303020.Activities.Type,
CR303020.Activities.Summary,
new SP303020.Field
{
FieldName = "NoteID",
ObjectName = CR303020.Activities.Summary.ObjectName
}
},
null, 0, false, false);
var newActivity = activities.FirstOrDefault(a => origActivities.FirstOrDefault(o => o[2] == a[2]) == null);
我正在使用 Web API 将机会活动推送到使用屏幕 ID SP303020 的 Acumatica 合作伙伴门户。我需要从 Acumatica 合作伙伴门户获取新创建的 NoteID,它是 CRActivity table 中的唯一标识符,并存储到我的数据库中,这样我就不会再次推送相同的机会活动并创建重复项。
这是我用来获取新创建的机会的代码 Activity NoteID,但我没有得到任何东西
SP303020WS.Screen context = new SP303020WS.Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.AllowAutoRedirect = true;
context.EnableDecompression = true;
context.Timeout = 1000000;
context.Url = "https://sso.acumatica.com/Soap/SP303020.asmx";
SP303020WS.LoginResult result = context.Login(username, password);
SP303020WS.Content CR303020 = context.GetSchema();
context.Clear();
#region Push Activity to Partners Portal
SP303020WS.Content[] CR303020Content = context.Submit
(
new SP303020WS.Command[]
{
new SP303020WS.Value
{
Value = actiPartner.AcumaticaCaseID,
LinkedCommand = CR303020.Opportunity.OpportunityID
},
new SP303020WS.Value
{
Value = actiType,
LinkedCommand = CR303020.Activities.Type
},
new SP303020WS.Value
{
Value = actiCloud9.Subject,
LinkedCommand = CR303020.Activities.Summary
},
new SP303020WS.Value
{
Value = actiCloud9.Body,
LinkedCommand = new SP303020WS.Field { FieldName="Body", ObjectName="Activities"}
},
new SP303020WS.Value
{
Value = actiCloud9.StartDate.ToString(),
LinkedCommand = CR303020.Activities.StartDate
},
CR303020.Activities.ServiceCommands.NewRow,
CR303020.Actions.Save
}
);
#endregion
#region Getting Newly created Opportunity Activity NoteID
SP303020WS.Screen s2 = new SP303020WS.Screen();
s2.CookieContainer = context.CookieContainer;
SP303020WS.Content schema2 = s2.GetSchema();
var commands1 = new SP303020WS.Command[]
{
schema2.Opportunity.OpportunityID,
new SP303020WS.Field { FieldName="NoteID", ObjectName="Activities"},
};
var data = s2.Submit(commands1);
#endregion
请检查下面的代码片段:
SP303020.Screen context = new SP303020.Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.Url = "https://sso.acumatica.com/Soap/SP303020.asmx";
SP303020.LoginResult result = context.Login("***", "***");
SP303020.Content CR303020 = context.GetSchema();
var origActivities = context.Export
(
new SP303020.Command[]
{
new SP303020.Value
{
Value = "OP00013116",
LinkedCommand = CR303020.Opportunity.OpportunityID
},
CR303020.Activities.Type,
CR303020.Activities.Summary,
new SP303020.Field
{
FieldName = "NoteID",
ObjectName = CR303020.Activities.Summary.ObjectName
}
},
null, 0, false, false);
SP303020.Content[] CR303020Content = context.Submit
(
new SP303020.Command[]
{
new SP303020.Value
{
Value = "OP00013116",
LinkedCommand = CR303020.Opportunity.OpportunityID
},
CR303020.Activities.ServiceCommands.NewRow,
new SP303020.Value
{
Value = "Note",
LinkedCommand = CR303020.Activities.Type
},
new SP303020.Value
{
Value = "Test Note 3",
LinkedCommand = CR303020.Activities.Summary
},
CR303020.Actions.Save
}
);
var activities = context.Export
(
new SP303020.Command[]
{
new SP303020.Value
{
Value = "OP00013116",
LinkedCommand = CR303020.Opportunity.OpportunityID
},
CR303020.Activities.Type,
CR303020.Activities.Summary,
new SP303020.Field
{
FieldName = "NoteID",
ObjectName = CR303020.Activities.Summary.ObjectName
}
},
null, 0, false, false);
var newActivity = activities.FirstOrDefault(a => origActivities.FirstOrDefault(o => o[2] == a[2]) == null);