0
현재 엔티티와 관련된 모든 노트의 목록 (예 : 컬렉션)을 얻는 방법은 무엇입니까?노트 목록 가져 오기
나는 어떤 식 으로든 service.Retreive (...)와 연결되어 있지만 작동 코드를 만들 수는 없다는 것을 알고 있습니다.
1 첨부 :
public void Execute(IServiceProvider serviceProvider)
{
Entity entity = null;
var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
if (entity.Contains("new_parentopportunity"))
{
try
{
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = factory.CreateOrganizationService(context.UserId);
Guid projectGuid = entity.Id;
Guid oppGuid = ((EntityReference)entity["new_parentopportunity"]).Id;
for (int i = 0; i < 100; i++) //Instead of 100, I'll place obtained collection.Length
{
Entity opp = service.Retrieve("", oppGuid, new Microsoft.Xrm.Sdk.Query.ColumnSet(true)); //RETREIVE ENTITY NOTE HERE
var temop = CreateNoteAttachment(opp);
service.Create(temp);
}
}
catch (Exception ex)
{
throw new InvalidPluginExecutionException("An error occurred in the plug-in.", ex);
}
}
}
private Entity CreateNoteAttachment(Entity oppNote)
{
//some code here
}
업데이트 1 :
나는 또한 당신이 whethere 모든 것을 잘가,이 볼 수, 쿼리에 쓰기? 초기 바운드
:
var notes =
service.AnnotationSet.Where(annotation => annotation.Opportunity_Annotation.Id == entity.Id)
.Select(annotation => annotation.Id)
.ToList();
FetchXml : PasteBin
공유하는 몇 가지 코드가 있습니까? 무엇을 시도 했습니까? 어디에서 잘못 가고 있습니까? – Marcus
@Marcus, 예 코드를 게시했습니다. 나는 서비스에 넣어야 할 것이 무엇인지 이해하지 못한다. 회귀() 또한, 쿼리 생성을 통해이를 수행하는 방법을 보았다. –
플러그인은 하나의 엔티티에서 다른 엔티티로 모든 노트를 복사하는 것에 관한 것이다. –