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
chuckwalleychuckwalley 

Save error: Condition expression must be of type Boolean

Not sure if I've lost my mind, but I keep getting an error message with this IF statement: 

if (indexOfString > zero)

 

The message is: Save error: Condition expression must be of type Boolean

 

What am I missing???

 

----------------------------------------------------

integer zero = 0;

string myDeveloperName = myUserRoleB.DeveloperName;
integer indexOfString = myDeveloperName.indexOf('_groupshare');

if (indexOfString > zero)
 {
System.debug('#################### ListHeirarchyRoles() MilePost getRolesToShare-0600');
// turn switch to null and get out with UserRole.Id
myUserRoleParentRoleId = null;
myUserRoleId = myUserRoleB.Id;
}
else if (myUserRoleParentRoleId = null)
{
System.debug('#################### ListHeirarchyRoles() MilePost getRolesToShare-0700');
// switch is null - get out with UserRole.Id
myUserRoleId = myUserRoleB.Id;
}

else
{
System.debug('#################### ListHeirarchyRoles() MilePost getRolesToShare-0700');
// get next check ready and keep Parent Role Id active so we stay in the loop
myUserRoleParentRoleId = myUserRoleB.ParentRoleId;
myUserRoleId = myUserRoleB.ParentRoleId;
}

Best Answer chosen by Admin (Salesforce Developers) 
aballardaballard

I expect it is really this line that is wrong

 

else if (myUserRoleParentRoleId = null)

 

Needs to be ==

 

(This should be in the apex board, not visuaflroce. )

 

 

All Answers

aballardaballard

I expect it is really this line that is wrong

 

else if (myUserRoleParentRoleId = null)

 

Needs to be ==

 

(This should be in the apex board, not visuaflroce. )

 

 

This was selected as the best answer
chuckwalleychuckwalley

DOH!!  Right on both counts!  THANKS nonetheless!