Java Snippet (Simple) Failed "This method must return a result of type String"

I’m trying to add some condition to a specific name.
If the is name==“A” add column emails Contact with specific address emails
I dnt Know where is my fault??

As it is written, you could get to the end of your If/else if branches without returning a value. It may be that you have covered all your possible options here already, but the snippet has no way of knowing that. Simplest solution might be to add return null; to the end - then if you dont meet one of your conditions you will get back a missing cell.

Steve

1 Like

I add your condition but my output wrong its appear NULL (empty)

this is my snippet code :

if ($name$==“Competitors 1”)
{
return “abdelaziz.mokrani@roche.com , abdlzizmokrani1@gamil.com”;
}
else if ($name$==“Competitors”)
{
return"abdelaziz.mokrani@roche.com";
}
else if ($name$==“Competitors2”)
{
return"abdelaziz.mokrani@roche.com";
}
else{
return null;
}

OK, try also using $name$.equals("Competitors 1") etc in place of $name$==“Competitors 1” throughout your snippet.

Steve

Yes it workes now !! Thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.