+ Start a Discussion
ArjunmcaArjunmca 

AND condition in IF

Hi,

 

I need to verify 2 conditions based on 1 condition.

 

When IF condition is true then i need to check two more conditions.

 

 

If(InProgress__c == True)

{

     AND(  (ISPICKVALUE('YES') , (ISBLANK(EMP_Num__c) )

}

 

How can i write that formula.  

 

Thanks,

Arjun. 

Best Answer chosen by Admin (Salesforce Developers) 
lakslaks

Hi Arjun,

 

Assuming that you want to check whether InProgress__c == True, then check if the picklist value is Yes AND EMP_Num__c is blank and then return some value based on the result.

 

The syntax to achieve the same would be:

 

IF( InProgress__c == 'True',  IF(AND( ISPICKVAL(picklist_field, text_literal) , ISBLANK(expression)), value_if_true, value_if_false)  , value_if_false)

 

Here the inner value_if_truevalue_if_false refers to the value returned by the inner if condition & the outer  value_if_false refers to the value returned when InProgress__c is not equal to True.

 

Hope this helps.

 

Regards,

Lakshmi.

All Answers

lakslaks

Hi Arjun,

 

Assuming that you want to check whether InProgress__c == True, then check if the picklist value is Yes AND EMP_Num__c is blank and then return some value based on the result.

 

The syntax to achieve the same would be:

 

IF( InProgress__c == 'True',  IF(AND( ISPICKVAL(picklist_field, text_literal) , ISBLANK(expression)), value_if_true, value_if_false)  , value_if_false)

 

Here the inner value_if_truevalue_if_false refers to the value returned by the inner if condition & the outer  value_if_false refers to the value returned when InProgress__c is not equal to True.

 

Hope this helps.

 

Regards,

Lakshmi.

This was selected as the best answer
ArjunmcaArjunmca

Hi Lakshmi,

 

It works. Do you have salesforce blog with articles or links or training material? 

 

Thanks,

Arjun.

 

lakslaks

Hi Arjun,

 

Happy to know that it resolved your issue.

 

The developer force site has documentations - http://wiki.developerforce.com/page/Documentation.

Guess you would have checked that out already.

 

Some blogs that I have found useful:

http://bobbuzzard.blogspot.in/

http://blog.jeffdouglas.com/

There are lot more. 

 

If you are looking for video tutorials I think this link will be useful - http://salesforcechannel.com/

 

 

Regards,

Lakshmi.

ArjunmcaArjunmca

 

Hi,

 

Thank you again. I need another help

 

 I need to assign a value of picklist to another picklist. Those two picklists are same, picklist name is Status with values 'Open', 'Close'.

These two picklists are in different places, but if one picklist value modifies, automatically another picklist value should update.

 

Note: Both fields must be picklists, it can't be one picklist and one Text, because i should be able to modify status in any place, but it should update in another place.

 

I tried field update with workflow rules  using the below formula, but it doesnot work.

 

IF(Picklist1_Value__c <> Picklist2_Value__C, Picklist2_value__c, false)

 

IF(Picklist2_Value__c <> Picklist1_Value__C, Picklist1_value__c, false)

 

Thanks,

Arjun

lakslaks

Hi Arjun,

 

Check out 'Dependent picklists' functionality. (http://login.salesforce.com/help/doc/en/fields_defining_field_dependencies.htm) I think that should work.

 

Else you can get it done via Apex coding. But I guess you would like to check out the declarative capabilities before going into Apex.

 

Regards,

Lakshmi.

ArjunmcaArjunmca

Lakshmi, the link which you sent in the previous post does not exist. Could you send any other link.

 

ArjunmcaArjunmca

How to bind user name to an Input field. I knew that we can get user name by passing user id to visual force page as explained in the below link

 

http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#StartTopic=Content/pages_controller_quickstart.htm

 

 

But i am not able to find user id from that page. We have only one visualforce page which was deployed in the production.

When user acccess that page by the entering the url in IE, it asks for user name and password to login, after entering login details, VF page displays ,but it doesn't have user id in the url. Then how can i get user name to display a message as "Welcome <UserName>".

 

     <apex:inputField value="{!User.FirstName}" />

 The above binding is not working.  Please let me know how to resolve this issue.

 

Thanks

lakslaks

Check out by including the $.

It should be - {!$User.FirstName}

 

 

lakslaks

Regarding dependent picklists, do check out this link - http://ap1.salesforce.com/help/doc/en/fields_defining_field_dependencies.htm

ArjunmcaArjunmca

I tried with {!$User.Firstname}. But i got below below error.

 

Error: Could not resolve the entity from <apex:inputField> value binding '{!$User.Firstname}'. <apex:inputField> can only be used with SObject fields.

 

 

 

lakslaks

Oh ok. Hadn't noticed that you were trying to use it with inputField. 

inputField is used to directly bind with the corresponding fields in an object.

 

You will have to use <apex:outputText>.

 

Regards,

Lakshmi.

ArjunmcaArjunmca

Laks,

 

My requirement is user name should prefill automatically and also i should be able to change the user name. That's why i choose input field.

Then how can i do that?

ArjunmcaArjunmca

HI,

 

There is possibility to have blank values for a column in one of the object.

I am want to write a query to eliminate blank records.

 

I tried with distinct, but it doest work.  I know distinct is for eliminating duplicate records.

select dintinct(comments__c) from CsoObject__c where Product = 'Card';

 

Thanks

Arjun.