8.4… I will trying to provision an email generator for data which is coming from HR system below is my code but i getting error
the application script threw an exception: java.lang.nullpointerexception: Null pointer in method Invication BSF info: email creation at line: 0 column: 0 cloumn No
String uniqueEmail=“”;
int increment=0;
String domain="@test.com"; // change to actual domain
String firstName=“”;
String lastName=“”;
// Update the block to add your logic for email generation
firstName = identity.getAttribute(“firstname”); // change firstname to first name attribute value from identity mapping
lastName = identity.getAttribute(“lastname”);; // change lastname to last name attribute value from identity mapping
lastName= lastName.replaceAll(“[\[.\]+]”, “”);
This means there is a syntax error in your code:
for example: lastName = identity.getAttribute(“lastname”);; should contain one semicolon instead of 2.
I’ve remove the semi colon but still same error.
Then I added
boolean checkUniquemail(String uniqueEmail) {
If( uniqueEmail == null)
return null
remaining code
}
remaining code…
but still same issue
It looks like you have not pasted the complete code. It is difficult to check and let you know where you are getting this error. Though you can try by putting null checks as others suggested. Besides this, while checking the logs, if you come down a little more, you will get more details, like from which object reference you are trying to call which method which is throwing the expectation. Please try and let us know.
I tried this code but getting below error
bean shell Script error: bsh.parseExecption: parse at line 31. cloumn 44. Encountered; BSF info: Emation creation at line: 0 column: cloumn No.
Looks syntactical error at line number 32. Please check at line number 32 and provide a screenshot of it. Will check it. Take the code from source and put in notepad++ or any editor. and check at line 32. You will get exactly where the issue you are getting.
if (Util.isNotNullOrEmpty(lastName)) {
lastName= lastName.replaceAll(“[[.]+]”, “”);
}
if (Util.isNotNullOrEmpty(firstName) @and Util.isNotNullOrEmpty(lastName)) {
uniqueEmail = firstName + lastName + domain;
} else if (Util.isNotNullOrEmpty(firstName)) {
uniqueEmail = firstName + domain;
} else if (Util.isNotNullOrEmpty(lastName)) {
uniqueEmail = lastName + domain;
} else {
throw new IllegalArgumentException(“Both first name and last name cannot be null or empty”);
}