You need to sign in to do that
Don't have an account?
Erich.Weihrauch
Need help debugging some javascript code...
Ok so its not Apex but wasn't sure where else to post this in...
Basically, I have a field in a case that you can enter in JIRA issue #'s into, e.g. SW-001, RMA-001, etc.
Right now, it works such that for multiple entries, you'd enter in SW-001,RMA-001 (no spaces, and seperated only by a comma).
I've been trying to parse it at least one additional way for now, which is to have it such that I can remove white spaces so that I can do SW-001, RMA-001 , but so far I've been unable to do so.
Can someone help me figure out what I'm doing wrong there?
Code:
{!REQUIRESCRIPT("/soap/ajax/8.0/connection.js")} var c = new sforce.SObject("Case"); c.JIRA = "{!Case.JIRA_Case__c}"; c,JIRA = (c.JIRA).replace(' ',''); var mySplit = c.JIRA.split(","); for(i = 0; i < mySplit.length; i++) { window.open('http://sever:8080/browse/'+mySplit[i]); }
Right now, it works such that for multiple entries, you'd enter in SW-001,RMA-001 (no spaces, and seperated only by a comma).
I've been trying to parse it at least one additional way for now, which is to have it such that I can remove white spaces so that I can do SW-001, RMA-001 , but so far I've been unable to do so.
Can someone help me figure out what I'm doing wrong there?
So, aside from the compile issue, you need the JS equivalent of replaceAll. I believe replace only replaces the first occurrence of the search term.
Try a regular expression like
Cheers
Problem is, it doesn't seem to touch the spaces..above it should have replaced a space with a + but did not.
That and if I don't have the space replace funtion before the joining of , the command opens up a window for each character in the field!
Try this: