Hi Community there,
Could anyone please help, many thanks!
I want to user field 'phone_mobile' to filter all related user via calling endpoint: XXXX/Contacts/filter
I can get some records by setting pload in the request:
Hi Community there,
Could anyone please help, many thanks!
I want to user field 'phone_mobile' to filter all related user via calling endpoint: XXXX/Contacts/filter
I can get some records by setting pload in the request:
No external tool needed for accomplishing such formatting. SugarLogic formula is able to do the job.
Create one custom field for each phone field and set a sugarLogic formula this way:
ifElse(
equal(subStr($phone_mobile,0,1),"+"),
strReplace(" ","",$phone_mobile,false),
concat("+",strReplace(" ","",$phone_mobile,false))
)
Regards
Hello Sophie,
Sorry for the delay with the response.
Could you specify first if you are trying to filter users or contact?
Actually, I see 3 types of efforts that could help with the challenge:
1) to set up phone validation logic, preventing users from entering non-formatted phones
2) to format entered phone automatically - each time the user profile is saved - according to the preconfigured logic
3) to set up a custom endpoint for the external call, so that users keep their phones formatted in Sugar as they want, but get them formatted on the fly for search purposes when the endpoint is called
The first option is preventive, the second is supportive, and the third is "to configure for me" - due to a relatively high computing load, the last wouldn't work if you have dozens of thousands of records (like Contacts) but should work for hundreds (like the number of Users)
Which of 3 would better work for your circumstances?
Best Regards,
Dmytro Chupylka
integroscrm.com
We make work in Sugar CRM system faster, more convenient and efficient
Hi Dmytro,
Thank you for your reply.
First, I'm trying to filter the module 'Contacts' and it has 30K records. I want to get id when the phone number field matches.
So I guess the third option is not suitable.
As to the first option, when you're saying 'it is preventive', do you mean it's forbidden to do so ?
And how can I do the second option, please?
Thanks a lot!
Hi Andre,
It works!
Thank you so much!
Just one thing, how can I update the history records for the custom field via action recalculating?
When I choose the records in Contacts list view, there's no 'recalculate' in the action.
Thanks!
Hi Andre,
I just found the 'recalculate' action.
But one more help, please:
Because our phone number format is really inconsistent, it has space , '-', etc. It's really dirty.
I know I can just nest the ifElse,
but I just want to know, is regular expression possible?
Could you please share a sample?
Thank you very much!
Hi Andre,
sorry about so many messages...
just two more thing to check,
1. what’s this language is? What else I can use except ifElse?
2. If I use a quite long nested ifElse, will it affect my instance’s performance? I have 30K records.
Million thanks!
Hi Sophie,
I agree with Jeroen reply that the easiest way is to export all Contacts (e.g. create Rows & Columns Report with Contact ID and Phone Number and export it), then to clean up phones using Excel and then using out-of-the-box import to import updated file (Sugar will update Contacts by ID if you select 'Create new records and update existing records' in Import wizard).
Once data is cleaned up, to prevent such scenario in the future it is nice to have a check on Phone fields that an entered value contains only + and numbers. For this task you could code as mentioned or try out Logic Builder configuration tool.
Here is an example of such validation:
And of course the result in the interface:
...and a zip package to try validation on your instance:)
Hi Anastasiia,
Thanks for your reply!
I just download your zip file and upload via 'module loader' and then do the 'Quick Repaire and Rebuild'. But When I try to create a new Contacts, the validation doesn't work.
Could you please share how the steps after download your package?
Thank you so much!
Hi Sophie,
Scripts on the client side are cached in a browser, so after applying new scripts it's needed to clean your browser cache to see the changes (or just try to reload the page not from the cache, like ctrl+shift+R).
Hi Anastasiia,
I tried with ctrl+shift+R, it still doesn't work.
What else can I do please?