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
DRobi83DRobi83 

Search on partial characters of a Autonumber field (Name) on a custom object

Hello

 

I have created a custom object (Ticket) and i autonumber the name field TNXXXXXXX.

 

I am at ticket number TN0003253

 

I can search on exactly "TN0003253" and i get a result, but when i search on "3253" i get no results. OPnbiously you ask the customer for their number, and dont want to type in the TN or the zeros.

 

I have tried creating another custom field, making it externalID, and workflowing the value in, but this does not seem to work either. I have added my new custom field (Tickey Number Search) into the search results on the object. No go.

 

Does anyone have any ideas how you can search partially on a autonumber name field type?

 

My other idea was to create a field, and then take the right 4 characters and place it in there, but this is not scalable once it his 5 characters on the right.

 

Thanks


David

Navatar_DbSupNavatar_DbSup

Hi,

 

You want to search the record in custom object on the basis of the some values you can use the like operator in the query

 

Try the below code snippet as reference in your developer console:

 

 Ticket__c[]tt=[select id,name from Ticket__c where name like '%03253%'];

system.debug('$$$$$$$$$$'+tt);

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

Teach_me_howTeach_me_how

I am encountering this . What is the solution?