• Florian Hoehn
  • NEWBIE
  • 65 Points
  • Member since 2014
  • Founder
  • Cloud-Craft

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 12
    Replies
Hi all,

We are sending our sales people an e-mail when they have a new opportunity. I would like to a put a link directly to the opportunity in the e-mail. Does anyone know how I can do this?

Thanks,
Erica
I have been analyzing this topic for quite a few days.

The problem I am now facing is:

I have a custom Object "Task_Flow_Manager" on Account Detail page .
On clicking 'new' button of "Task_Flow_Manager", I am directed to a bridge page for selecting record type.
After selecting the record type, I click "continue" button to be directed to the real page for creating new object of "Task_Flow_Manager"

On the page for creating "Task_Flow_Manager", I have quite a lot Lookup fields related to dates or User object  to be populated.

A lot of solutions require URL hacking.
But I can not customize the 'new' button since it resides on a bridge page.

I also tried to set the value by using JavaScript "getelementByID", but somehow failed.

I am trying to create a Visualforce page myself and provide values to populate those Lookup fields
by using an Extension method.

However, I don't know how to give the "Apex:Inputfield" component a default value.
I had created 4 Record Types i want to display only 2 Record Types to users and want to hide 2 record types how can i do it using security settings
Hi all,

We are sending our sales people an e-mail when they have a new opportunity. I would like to a put a link directly to the opportunity in the e-mail. Does anyone know how I can do this?

Thanks,
Erica
Hi,

Any one help to write test class for webservice class

Thank you
Hi everyone.

Can you please help me to fix this error: I have a trigger that would send an email alert to new AssignedTo user. But it through an error if the Site Defect is a new record. in other word when the Trigger.old[0].Assigned_To__c is empty. 

here is the code:

trigger SendEmailAlertToAssignedTo on Site_Defects__c (after insert, before update) { // I have the error message here

    if(Trigger.new[0].Assigned_To__c != Trigger.old[0].Assigned_To__c ) {
       
            //Sending Mail
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage() ;
          
                //Setting user email in to address
            String userName = Trigger.new[0].Assigned_To__c;
             
            User AT = [Select Email From User where id= : userName ]; 
            String userEmail = AT.Email;
          
          
            //String email = Trigger.new[0].RegionalManager__c;
            String[] toAddresses = new String[] {userEmail} ;
          
            // Assign the addresses for the To and CC lists to the mail object
            mail.setToAddresses(toAddresses );
            mail.setToAddresses(MyEmail);
          
            //Email subject to be changed
            mail.setSubject('THIS IS A TEST. Site Defect Owner Changed');
            String body = AT.Email+'The owner of Site Defect ' + trigger.Old[0].Name +' has been changed <br> <br>'+
            'Regards <br> ';
            //Body of email
            mail.setHtmlBody(body);
          
            //Sending the email
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
            }
}

Thank you. 
Hi guys,

I'm developing an app as a managed package. And I'm running in to two issues:
- How can I supply my customers with additional unmanaged elements to install on top of the package?
- How can I build a plug-in style managed package to work along side my core managed package?

For the first question: I'd like to include some additional parts of it as unmanaged. Things like:
- Pre-built reports
- Custom report types
- Email templates
- Customizable buttons

I have my primary managed app: JayNicsApp - Core.
Then I created two supplementary unmanaged apps: JayNicsApp - Reporting, JayNicsApp - Templates.

But when I created them, it went ahead and added all the dependancies from the managed app to the unmanaged package...
My desired outcome would be a package with just the elements that I want unmanaged and delivered to the customer. If the customer does not have the managed package installed underneath - it should fail to install. I don't want to have to add all of my code and customizations 
to an unmanaged package just for some silly reports...

For the second question:
I'd like to build another piece of managed code that can sit on top of my original core managed package. This would be something like some integrations between my custom objects and CRM objects (Opportunity, Case etc..). This integration would not come standard in the manged package core and would only be needed by customers if they had CRM and not just a Platform license.
How can I go about building that?


Really appreciate the help.
Thanks
-JayNic
 
  • January 24, 2014
  • Like
  • 0
So here is my issue. I have a class that does a validation to check if things are oaky before user can convert the lead. What i am trying to do is check to see if the RSD ID listed on the territory object matches the Assigned to ID on the QSL object. Below is the code i have thus far but keep getting relationship error. can anyone help

// North America Territory assignment
     if (this.lead.Territory__c.Name == 'NA -*'){
    
      RSD = [Select ID,Regional_Sales_Director__c.Name from Territory__c where ID := Territory__c.Id];
      primeQ = [Select ID, Assigned_To__c.Name From QSL_Review_Request__c Where ID := QSL_Review_Request__c.ID];
    
      if (!isMatch(primeQ)){
       addError('Please update the lead owner to the correct queue. If this is a PRM lead or you need help, contact salesops@imperva.com');
       isValid = false;
     
      }
    
     }
Hello,

I think I'm trying to do something pretty simple, but I am getting an error.  My trigger below is meant to fire when an Opportunity is updated.  All it's supposed to do is pull the value from 1 of 2 custom fields (Consultant_Partner_Primary__c and Consultant_Partner_Secondary__c) at the associated Account based on the value the user enters in a picklist field (Consultant_Type__c) on the Opportunity.  When I try to update an Opportunity, I get the following error:

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger UpdateConsultOpp caused an unexpected exception, contact your administrator: UpdateConsultOpp: execution of AfterUpdate caused by: System.FinalException: Record is read-only: Trigger.UpdateConsultOpp: line 7, column 1



Can anyone help why I am getting this error?  Thanks,


trigger UpdateConsultOpp on Opportunity (after Insert, after Update) {

    // Update Consultant Partner field with value from Account
    FOR(Opportunity o : Trigger.New){
       
        IF(o.Consultant_Type__c == 'Primary Consultant'){
            o.Consultant_Partner__c = o.Account.Consultant_Partner_Primary__c;
        }
       
        ELSE IF(o.Consultant_Type__c == 'Secondary Consultant'){
            o.Consultant_Partner__c = o.Account.Consultant_Partner_Secondary__c;
        }

}

}


  • January 24, 2014
  • Like
  • 0
I have been analyzing this topic for quite a few days.

The problem I am now facing is:

I have a custom Object "Task_Flow_Manager" on Account Detail page .
On clicking 'new' button of "Task_Flow_Manager", I am directed to a bridge page for selecting record type.
After selecting the record type, I click "continue" button to be directed to the real page for creating new object of "Task_Flow_Manager"

On the page for creating "Task_Flow_Manager", I have quite a lot Lookup fields related to dates or User object  to be populated.

A lot of solutions require URL hacking.
But I can not customize the 'new' button since it resides on a bridge page.

I also tried to set the value by using JavaScript "getelementByID", but somehow failed.

I am trying to create a Visualforce page myself and provide values to populate those Lookup fields
by using an Extension method.

However, I don't know how to give the "Apex:Inputfield" component a default value.
Hi ,

I have a visual force page  and an  controller .

We have a Button in my VF page called Continue ...>

when i click on this button i want to display below pageblock  " Select Email Template Folder " and " Select Email Template".

Currently i am viewing te VF Page with  pageblock  " Select Email Template Folder " and " Select Email Template" with out clicking the Contionue.

This my VF Page can any one help me out

<apex:page standardController="Event_Registration__c" extensions="MassEmailEvent" id="pageid" sidebar="true" showHeader="true" tabStyle="Contact">

<style>
.mmSubheader {
background-color= #E2E3E5;
font size: 1em;
margin: 18px 0 7px;
padding: 4px 9px;
color: black;
font-weight:bold;
}
.label{
padding:3px;
color: #222222;font-family: Arial,Helvetica,sans-serif;
}
.he1 {

     font-weight: bold;
     -moz-user-select: text;
    font-family: 'Arial','Helvetica',sans-serif;
    font-size: 100%;
    line-height: normal;
    border-style: none solid none none;
    border-width: 0 1px 0 0;
    padding: 2px 0 3px;
    vertical-align: baseline;
     border-left-color: #EEEEEE;
    border-right-color: #D0D0D0;
    border-left: 1px solid;
    border-right: 1px solid;
    -moz-user-focus: normal;
    outline: medium none;
    text-align: left;
}
</style>
<script type="text/javascript">
    function checkAll(cb,cbid)
        {
            var inputElem = document.getElementsByTagName("input");                   
            for(var i=0; i<inputElem.length; i++)
            {           
                 if(inputElem[i].id.indexOf(cbid)!=-1){                                      
                    inputElem[i].checked = cb.checked;
                }
            }
        }
</script>
<script language="javascript" type="text/javascript">
var pickListArray=[];
var campaignPickListArray=[];
function popUpLookUpWindow(url,col,val) {
      var colValue=document.getElementById(col).value;
      if(colValue!='None'){
      url=url+'&column='+colValue+'&val='+val;
    newwindow=window.open(url,'name','height=430,width=620,toolbar=no,resizable=yes,scrollbars=yes');
    if (window.focus) {newwindow.focus()}
    }
}
function closePopUp(){
   if (null!=newwindow)
    {
      newwindow.close();
    }
}
</script>
  <apex:form >
<apex:repeat value="{!pickListCol}" var="request">
        <script>
            pickListArray.push('{!request}');
        </script>
    </apex:repeat>
     <apex:repeat value="{!pickListCampaignCol}" var="list">
        <script>
            campaignPickListArray.push('{!list}');
        </script>
    </apex:repeat>
    <script>
   
function isPickList(selectedId,lookupId){

var val=document.getElementById(selectedId).value;
for (var i = 0; i < pickListArray.length; i++) {
// alert('pickListArray === ' + pickListArray[i]);
        if (pickListArray[i] ===val){
            document.getElementById(lookupId).style.display = "block";
            break;
            }else{
            document.getElementById(lookupId).style.display = "none";
            }
    }
}

function isCampaignPickList(selectedId,lookupId){
var val=document.getElementById(selectedId).value;
for (var i = 0; i < campaignPickListArray.length; i++) {
  // alert('campaignPickListArray=== ' + campaignPickListArray[i]);
        if (campaignPickListArray[i] ===val){
            document.getElementById(lookupId).style.display = "block";
            break;
            }else{
            document.getElementById(lookupId).style.display = "none";
            }
    }

}
  </script> <apex:sectionHeader subtitle="Mass Email"/>
<apex:pageBlock title="Step 1: Select email recipients">
<div class="mmSubheader">Select Event Name <apex:inputField value="{!eropty.Recruiting_Event__c}" id="crmcmpid">
  </apex:inputfield>
  
  <br></br>
  Attended <apex:inputField value="{!eropty.Attended__c}" id="crmcmpid1">
  </apex:inputfield>
  Attending <apex:inputField value="{!eropty.Attending__c}" id="crmcmpid2">
  </apex:inputfield>
Invited <apex:inputField value="{!eropty.Invited__c}" id="crmcmpid3">
  </apex:inputfield>
No Show <apex:inputField value="{!eropty.No_Show__c}" id="crmcmpid5">
  </apex:inputfield>
Not Attending <apex:inputField value="{!eropty.Not_Attending__c}" id="crmcmpid6">
  </apex:inputfield>
No Responce<apex:inputField value="{!eropty.Not_Attending__c}" id="crmcmpid7">
  </apex:inputfield>
 
  <br></br>
 
 
 
 

</div> 

      <div class="mmSubheader" style="display:none">Choose Member Type to Search          </div>   
<div class="mmSubheader"></div>
 
    <apex:outputPanel id="criteria">
          <apex:actionstatus id="status" startText="Loading...">
             <apex:facet name="stop">
           
               <apex:outputPanel >
              
            
            <apex:commandButton action="{!go}" value="Search" reRender="searchProgress,results1,dTable" status="searchProgress" />
            <br/>
            <apex:actionStatus id="searchProgress">
                        <apex:facet name="start">
                            <table align="center" border="0">
                                <tr>
                                    <td style="vertical-align:middle;" align="center">
                                        <img src="{!$Resource.saveStatus}"/>
                                    </td>
                                </tr>
                            </table>
                        </apex:facet>
</apex:actionStatus>
              </apex:outputPanel>
         
            </apex:facet>
          </apex:actionstatus>
     </apex:outputPanel>
      <br/>
     <apex:pageBlockSection columns="1" >
     <script type="text/javascript">new MenuButton('MyMenu', false);</script>

    <apex:pageBlockTable id="dTable" value="{!contactList}" var="dat"  border="1" cellspacing="2px" width="100%" headerClass="he1" cellpadding="4px" columnsWidth="60px,150px,150px,150px,170px" >
     <apex:column ><apex:facet name="header">
<apex:inputCheckbox onclick="checkAll(this,'checkedone')"/>
</apex:facet>
<apex:inputCheckbox value="{!dat.selected}" id="checkedone"/></apex:column>
   <apex:column headerValue="First Name"  ><apex:outputField value="{!dat.con.FirstName}" rendered="{!IF(ISBLANK(dat.con.FirstName), 'false', 'true')}"/>
   </apex:column>
     <apex:column headerValue="Last Name" ><apex:outputField value="{!dat.con.LastName}" rendered="{!IF(ISBLANK(dat.con.LastName), 'false', 'true')}"/> 
      </apex:column>
     <apex:column headerValue="Title" ><apex:outputField value="{!dat.con.Title}" rendered="{!IF(ISBLANK(dat.con.Title), 'false', 'true')}"/>
     </apex:column>
     <apex:column headerValue="Account Name" ><apex:outputField value="{!dat.con.AccountId}" rendered="{!IF(ISBLANK(dat.con.AccountId), 'false', 'true')}"/> </apex:column>
     <apex:column headerValue="Email"  ><apex:outputField value="{!dat.con.Email}" rendered="{!IF(ISBLANK(dat.con.Email), 'false', 'true')}"/>
     </apex:column>
          </apex:pageBlockTable>
          </apex:pageBlockSection>
    
     &nbsp; &nbsp; <apex:commandLink action="{!previousResults}" value="Previous" reRender="emailTemplateBlock"/> &nbsp; | &nbsp; <apex:commandLink action="{!nextResults}" value="Next" reRender="dTable" />
       
   <br></br><br></br><apex:commandButton action="{!Save}" value="Continue..." disabled="emailTemplateBlock" onclick="emailTemplateBlock" reRender="displaypblock"/>
</apex:pageBlock>

        <apex:pageBlock title="Step 2: Select an email template" id="emailTemplateBlock" rendered="{!displaypblock}">
                Select Email Template Folder:
            <apex:selectList value="{!selectedEmailTemplateFolder}" multiselect="false" size="1">
                <apex:selectOptions value="{!emailTemplateFolderOpts}" />
                <apex:actionSupport event="onchange" action="{!refreshEmailTemplateSection}" rerender="emailTemplateBlock" />
            </apex:selectList>
            <br/><br></br>
            Select Email Template:
            <apex:selectList value="{!selectedEmailTemplate}" multiselect="false" size="1" >
                <apex:selectOptions value="{!emailTemplateOpts}" />
<apex:actionSupport event="onchange" action="{!refreshEmailTemplateSectionid}" rerender="emailTemplateBlock" />               
                            </apex:selectList>
             <apex:outputLink target="_blank" value="{!emailTemplateId}">Preview</apex:outputLink>            <br/><br></br>
                      
<apex:commandButton action="{!SendEmail}" value="Send Email" rendered="{!if(emailTemplateOpts.size > 0, true, false)}"/>
    </apex:pageBlock>  </apex:form>
</apex:page>