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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

guid.slice() method

(0) ShareShare
ReportReport
Posted on by 1,214

Hi All..

I'm trying to debug some javascript errors & I've encountered this line of codes.

var guid = lookup[0].id;
guid = guid.slice(1, -1);

What is this guid.slice() method doing to the guid? What's the meaning of the (1, -1) parameters? I can't find any documentation regarding this method, so if you have any useful links, please help. I'd like to understand this method.

Thank You.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi Hairul,

    This is because in javascript the returned GUID will be as shown below.

    "{475B158C-541C-E511-80D3-3863BB347BA8}"

    In order to remove the first and last parentheses, we are using the guid.slice(1, -1).

    But it is not really required. It will work without this line too. The above GUID without removing the parentheses can be used.

    Hope this helps.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans