• Jahnvi Jasani
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
I have a custom field Renewal Date in Account object.
In Process builder,  I want total of 3 email alerts: 1. Before one month of renewal date. 2. Before one week of renewal date. 3. Before 3 days of renewal date.  and only if renewal is not done.  if renewal is processed in between then rest of email alerts should not get triggered.
I have taken one input text in visual force page for searching purpose - it searches from the Contact sObject.
Now, if user inputs only a single word then it should search from the FirstName fiels of Contact.
If user inputs 2 words or more than 2 words than it should search first word from FirstName of contact and rest words from the lastName of contacts.

my apex code:
public class AccountsRelatedContactsController {
    string keyword;
    List<Contact> results;   
    String str1;
    String str2;
    
    public string getkeyword(){
        return keyword;
    }
    public List<Contact> getresults(){
        return results;
    }
    public void setkeyword(string input){
        keyword=input;
        string[] str = keyword.split(' ',2);   
        str1=str[0];
        str2=str[1];
        system.debug('size of str is = ' + str.size());
        System.debug(str[0]);
        System.debug(str[1]);
        
    }
    Public PageReference search_new(){        
        
        results=(List<Contact>)[FIND :str1 IN Name fields Returning Contact(FirstName,LastName)][0];        
        
        return null;
    }
    public List<Contact> getContacts() {     
        Id accountId = apexpages.currentpage().getparameters().get('id'); 
        System.debug('Account id is = ' + accountId);
        if(accountId!=null){
            string query='Select Id, FirstName, LastName from Contact where AccountId=:accountId';        
            System.debug('Query result' + query);
            List<Contact> results=Database.query(query);       
            return results;  
        }else{            
            string query='SELECT Id, FirstName,LastName,LastViewedDate FROM Contact WHERE LastViewedDate !=null ORDER BY LastViewedDate DESC limit 10';
            List<Contact> acc=Database.query(query);
            return acc;
        } 
    }
}

my Visualforce page:
<apex:page controller="AccountsRelatedContactsController">
    <apex:form >
        <apex:pageBlock title="Contact List" id="contacts_list">      
            <apex:inputText value="{!keyword}"/>
            <apex:commandButton value="Search" action="{!search_new}"/>
            <apex:pageBlockTable value="{!results}" var="r">
                <apex:column value="{!r.FirstName}"/>
                <apex:column value="{!r.LastName}"/>
            </apex:pageBlockTable>
            <apex:repeat var="cont" value="{!Contacts}">
                <li>
                    <apex:outputLink value="/{!cont.ID}" > {!cont.FirstName} {!cont.LastName} </apex:outputLink>
                </li>
            </apex:repeat>      
        </apex:pageBlock>
    </apex:form>
</apex:page>

Thanks
Hi,

Please give some ideas around it:
Autopopulating CC while sending email response by workflow,Process builder

Thanks,
Silpi
Hi,
 
I have a pop up window which popups a visual force page. I am trying to close this popup and reload my original page when some action is done as follows

<script>
 function closeSearchWindow()
 {
    window.close();
 }
</script>
<apex:commandLink value="Attach" action="{!attach}"  onclick="closeSearchWindow();">
      <apex:param assignTo="{!myclient}" value="{!location.id}"/>
</apex:commandLink>

But this is not working. Is there any other way to do this.

Thanks,
Nimdhar


Message Edited by nimdhar on 04-29-2008 07:22 AM