Announcements
if (AllTaskReject(relatedTasks))
{
trace.Trace("check condition");
if (relatedTasks.Equals(769190003))
{
regardingCase["statuscode"] = new OptionSetValue(912450000);
regardingCase["description"] = "All task update csutaskstatus";
regardingCase["cos_csucasestatus"] = new OptionSetValue(769190006);
trace.Trace("bool 1");
}else
if (relatedTasks.Equals(769190002))
{
regardingCase["statuscode"] = new OptionSetValue(912450000);
regardingCase["description"] = "All task update csutaskstatus";
regardingCase["cos_csucasestatus"] = new OptionSetValue(769190002);
}
}
}
catch
{
throw;
}
}
public bool AllTaskReject(EntityCollection relatedTasks)
{
//check all the the task if rejected continue if on task not rejected do nothing
if (relatedTasks.Entities.All(x => x.GetAttributeValue<OptionSetValue>("cos_csutaskstatus")?.Value == 769190003))
{
return true;
//reject
}else
{
if (relatedTasks.Entities.All(x => x.GetAttributeValue<OptionSetValue>("cos_csutaskstatus")?.Value == 769190001))
{
return true;
//approve
}
else
{
return false;
}
}
if (AllTaskReject(relatedTasks))
{
trace.Trace("check condition");
if (relatedTasks.Equals(769190003))
{
regardingCase["statuscode"] = new OptionSetValue(912450000);
regardingCase["description"] = "All task update csutaskstatus";
regardingCase["cos_csucasestatus"] = new OptionSetValue(769190006);
trace.Trace("bool 1");
}else
if (relatedTasks.Equals(769190002))
{
regardingCase["statuscode"] = new OptionSetValue(912450000);
regardingCase["description"] = "All task update csutaskstatus";
regardingCase["cos_csucasestatus"] = new OptionSetValue(769190002);
}
}
}
catch
{
throw;
}
}
public bool AllTaskReject(EntityCollection relatedTasks)
{
//check all the the task if rejected continue if on task not rejected do nothing
if (relatedTasks.Entities.All(x => x.GetAttributeValue<OptionSetValue>("cos_csutaskstatus")?.Value == 769190003))
{
return true;
//reject
}else
{
if (relatedTasks.Entities.All(x => x.GetAttributeValue<OptionSetValue>("cos_csutaskstatus")?.Value == 769190001))
{
return true;
//approve
}
else
{
return false;
}
}
hi can some one know what wrong with this code
hi thanks that what i need
yes and its only have 2 choices
i am thinking about this
if (AllTaskReject(relatedTasks))
{
trace.Trace("check condition");
if (relatedTasks.Equals(769190003))
{
regardingCase["statuscode"] = new OptionSetValue(912450000);
regardingCase["description"] = "All task update csutaskstatus";
regardingCase["cos_csucasestatus"] = new OptionSetValue(769190006);
trace.Trace("bool 1");
}else
if (relatedTasks.Equals(769190002))
{
regardingCase["statuscode"] = new OptionSetValue(912450000);
regardingCase["description"] = "All task update csutaskstatus";
regardingCase["cos_csucasestatus"] = new OptionSetValue(769190002);
}
}
}
catch
{
throw;
}
}
public bool AllTaskReject(EntityCollection relatedTasks)
{
//check all the the task if rejected continue if on task not rejected do nothing
if (relatedTasks.Entities.All(x => x.GetAttributeValue<OptionSetValue>("cos_csutaskstatus")?.Value == 769190003))
{
return true;
//reject
}else
{
if (relatedTasks.Entities.All(x => x.GetAttributeValue<OptionSetValue>("cos_csutaskstatus")?.Value == 769190001))
{
return true;
//approve
}
else
{
return false;
}
}
Hi minh nhat,
Andrew Butenko is the boss. He was also helping me a lot whenever I had stuck. Andrew Butenko, It is appreciated.
If I answer your question then please mark it as verified.
Let me know if I can provide you with more details.
Thanks
Regards,
Abdul Wahab
Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
Direct/WhatsApp:+923323281237
E-mail: abdulwahabubit@outlook.com
Skype: abdul.wahabubit
Linkedin: www.linkedin.com/.../
I'm sorry, but I still don't understand what's your goal is. Try to rephrase what you are trying to achieve. Let's say:
On change of the state of the task I want to recheck if all the tasks of the parent case are completed and if so - update the cases's status to resolved or canceled.
Your turn.
Hi minh nhat,
Why do not you analyse, debug, and run your logic first in the console application? Your all similar concerns will resolve automatically.
If I answer your question then please mark it as verified.
Let me know if I can provide you with more details.
Thanks
Regards,
Abdul Wahab
Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
Direct/WhatsApp:+923323281237
E-mail: abdulwahabubit@outlook.com
Skype: abdul.wahabubit
Linkedin: www.linkedin.com/.../
if (AllTaskReject(relatedTasks))
{
if (relatedTasks.Equals(769190003))
{
regardingCase["statuscode"] = new OptionSetValue(912450000);
regardingCase["description"] = "All task update csutaskstatus";
regardingCase["cos_csucasestatus"] = new OptionSetValue(769190006);
}
if (relatedTasks.Equals(769190002))
{
regardingCase["statuscode"] = new OptionSetValue(912450000);
regardingCase["description"] = "All task update csutaskstatus";
regardingCase["cos_csucasestatus"] = new OptionSetValue(769190002);
}
}
}
catch
{
throw;
}
}
public bool AllTaskReject(EntityCollection relatedTasks)
{
//check all the the task if rejected continue if on task not rejected do nothing
if (relatedTasks.Entities.All(x => x.GetAttributeValue<OptionSetValue>("cos_csutaskstatus")?.Value == 769190003))
{
return true;
//reject
}else
{
if (relatedTasks.Entities.All(x => x.GetAttributeValue<OptionSetValue>("cos_csutaskstatus")?.Value == 769190001))
{
return true;
//approve
}
else
{
return false;
}
}
hi i have multiple choices and this can only use for one. So my idea is to use multiple if but they throw this error all not value return
Hello,
I keep seeing new threads for you. Help us to help you! I'm sorry but it's not clear what your code does and what's the goal you want to achieve.
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156