web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

(0) ShareShare
ReportReport
Posted on by

I have two fields avd_starttime and avd_stoptime. I am writing the below code to update the avd_stoptime field with datetime.now. But I am getting the error as "Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)."..PLease tell me where I am going wrong??

 internal static bool StopAht(ICrmContext context)
        {
            QueryExpression exp = new QueryExpression(avd_agenthandlingtime.EntityLogicalName);
            exp.NoLock = true;
            exp.ColumnSet.AddColumn(XrmAttributes.AgentHandlingTime.Id);
            exp.ColumnSet.AddColumn(XrmAttributes.AgentHandlingTime.StopTime);

            ConditionExpression CondOppId = new ConditionExpression();
            CondOppId.AttributeName = "avd_StopTime";
            CondOppId.Operator = ConditionOperator.Null;


           

            string timerId = XrmAttributes.AgentHandlingTime.Id;

            var coll = context.OrganizationService.RetrieveMultiple(exp);
            if (coll != null && coll.Entities != null && coll.Entities.Count > 0)
            {
                foreach (var ent in coll.Entities)
                {
                    avd_agenthandlingtime stopTimer = new avd_agenthandlingtime()
                    {
                        Id = new Guid(timerId),
                        avd_StopTime = DateTime.Now
                    };
                    context.AdminUpdate(stopTimer);


                }
            }
            return true;
        }

*This post is locked for comments

I have the same question (0)
  • ScottDurow Profile Picture
    21 on at

    It looks like the value for timerId doesn't contain a valid GUID - what is the value of  XrmAttributes.AgentHandlingTime.Id

  • Suggested answer
    Yadnyesh Kuvalekar Profile Picture
    4,102 on at

    Hi,

    XrmAttributes.AgentHandlingTime.Id


     As per above statement in your code, XrmAttributes.AgentHandlingTime.Id seems to have logical name of the field.

    string timerId = XrmAttributes.AgentHandlingTime.Id;


     In above line, you are setting the logical name of the field to timerId and in your loop, you are trying to convert it to GUID. How logical name can be converted into the GUID?

    Instead, try using below code:

    Id = ((Entity)ent).GetAttributeValue<Guid>(timerId),

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans