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
ra1ra1 

Is standard "lookup search" working in custom VF page based Publisher Action?

Hi,

I am trying to create a publisher action on Account using custom VF page as content source. This page simply creating contact associated with this account. Below is my code :
<apex:page standardController="Account" extensions="CreateNewContact_Mobile_VFCExt" showHeader="false" sidebar="false" standardStylesheets="true">
    <apex:form>
        <apex:commandButton action="{! createContact}" value="Save"/>
        <br/>
        <apex:outputLabel for="ContactFName">First Name: </apex:outputLabel>
        <apex:inputField value="{! newContact.FirstName}" id="ContactFName"/>
        <br/>
        <apex:outputLabel for="ContactLastName">Last Name: </apex:outputLabel>
        <apex:inputField value="{! newContact.LastName}" id="ContactLastName"/>
        <br/>
        <apex:outputLabel for="AccountId">Account : </apex:outputLabel>
        <apex:inputField value="{! newContact.AccountId}" id="AccountId"/>
    </apex:form>
</apex:page>

And my controller looks like :

public with sharing class CreateNewContact_Mobile_VFCExt {
    public Contact newContact {set; get;}

    public CreateNewContact_Mobile_VFCExt(ApexPages.StandardController controller) {

        String accId = ApexPages.currentPage().getParameters().get('id');
        newContact = new Contact();
        newContact.AccountId = accId;
    }

    public void createContact(){
        try {
            insert newContact;
            System.debug('@@ Successfully created new contact' + newContact.id);
        } catch(DMLException e) {
            System.debug('@@ Error while creating new contact : ' + e.getMessage());
        }
    }
}


I edited by Account Page Layout and added this publisher action.  
After this I am able to see newly added publisher action and everything works fine on Web but on mobile (i.e. Salesforce1) lookup link is not working.

Also, if I set "standardStylesheets" as FALSE then "lookup" icon is not comming too. 
Please suggest.

Thanks,
bob_buzzardbob_buzzard
The lookup functionality works for the installed iOS application as far as I know.  If you want the behaviour on another device you'll need to roll your own I'm afraid.
ra1ra1
@bob:Thanks a lot for your feedback.

I tried testing same on iPad (with installed Salesforce1 app) and I was able to see loopup icon. On click on this, new pop ups is comming and I was able to search using standard search feature.

But when I tried to select any particular record.. the pop up screen was gone but same for my custom VF page action. I was on same Account detail page without any publicher action icon (ie.  "+") also I was not able to perform anything on detail page as well. Salesforce1 app was allowing me to go to back screen (i.e. Recent Account List View) and if I select the same record again and click on "Publisher Action" again.. it was showing me global actions (not customize actions which I set on page layout).

After reloading the detail page, my selected publisher actions are back but facing the above problem again.. :(

In summary, below are steps I followed :
1. Login into Salesforce1 app
2. Go to Account tab and select a account record
3. Click on Publisher Action and select custom VF action (with same code mentioned in original question)
4. Remove pre-filled value from Account field & click on "Account" lookup icon
5. select any record from recent item list

Now both popup screen & my custom publisher action page are gone.. :(

Any idea or have I missed something here. 

Regards,