function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Accessing 18-digit object IDs via merge fields?

I am wondering if there is a way to get the 18-digit UI for an object via merge fields instead of the truncated 15-digit one.

For example, the {!Opportunity.Id} merge field might return 005700000014T5L, but if I access the same object via the APIs then it will be returned as 005700000014T5LAAU. I would like the full Id if possible.

I've run into the same problem in the past. I had two solutions that might be useful.

1. If I was comparing the 15-char Id (obtained through merge field) against an 18-char Id, I would just get the 15 characters of the 18 character ID through javascript substring method. Obviously that is only relevant if you already have the 18-char id.

2. I would take the 15-char id and run an api query through the AJAX Toolkit to get the 18-char. It seems redundant and a little bit of overhead, but it does the trick....