Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

brain freeze - workflow to update a record

Posted on by 1,695

CRm2016 On premises

Im having a brain freeze trying to update a record in a workflow. I have the ID of the record as a string , tried convering to guid  but just get errors Unable to cast object of type 'System.Guid' to type 'Microsoft.Xrm.Sdk.EntityReference'.

Public Shared Function UpdateRecord(_recordid As string, service As IOrganizationService, context As CodeActivityContext) As Boolean

            Try

                Dim _updaterecord As Entity = New Entity("new_dbfmlivedata")

                _updaterecord.Id = _recordid

                _updaterecord.Attributes.Add("new_processing", True)

                service.Update(_updaterecord)

                Return True

            Catch ex As Exception

                Globals.clsGlobals.WrtietoErrorLog("UpdateRecord " & ex.Message.ToString)

                Return False

            End Try

            Return False

        End Function

*This post is locked for comments

  • Pete_N Profile Picture
    Pete_N 1,695 on at
    RE: brain freeze - workflow to update a record

    DOH!  -- how sometimes the simple things are easily overlooked . Thank you for your help

  • Verified answer
    Dynamics365 Rocker Profile Picture
    Dynamics365 Rocker 7,755 on at
    RE: brain freeze - workflow to update a record

    Try

    _updaterecord.Id = new guid(_recordid)

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans