• Suneel#8
  • SMARTIE
  • 752 Points
  • Member since 2014

  • Chatter
    Feed
  • 24
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 11
    Questions
  • 189
    Replies
I have the below formula that has been working fine, until this month...

DATE( 
year(End_of_Mth__c) 
+ floor((month(End_of_Mth__c) + 4)/12) + if(and(month(End_of_Mth__c)=12,4>=12),-1,0) 

if( mod( month(End_of_Mth__c) + 4 , 12 ) = 0, 12 , mod( month(End_of_Mth__c) + 4 , 12 )) 

min( 
day(End_of_Mth__c), 
case( 
max( mod( month(End_of_Mth__c) + 4 , 12 ) , 1), 
9,30, 
4,30, 
6,30, 
11,30, 
2,28, 
31 


)

when my End of Mth date is 8/31/2014 the date being returned is 12/31/2015 instead of 12/31/2016.  All other months are working fine (before and after 8/31/2014) - I can't figure out why just that date is messing up?

Thank you!!
Hi

I have written my first trigger and and having some trouble extending it... at present it works fine allocation the correct user to a record based on postal code using a custom object.

My need is to exclude records bing created by certain user roles being affected by this trigger and having experimented with how to do this i have become stuck, any help would be greatly appreciated.

At pressent the trigger is as below

trigger Assignaccounts on Account (After insert, Before Update) {

List <account> accountstoupdate = new list<account>();
for (account newaccount : Trigger.new)

IF (newAccount.Key_Account__c != True)
if (newAccount != null)
if (newaccount.BillingPostalCode != null) 
If (account.BillingPostalCode != NULL)

{List<postcode__c> Postcodes = [ SELECT User__c FROM postcode__c WHERE name LIKE :newaccount.BillingPostalCode.SubString(0,2) + '%' limit 1];
if (postcodes.size()>0)
{newaccount.OwnerId = postcodes[0].User__c;

accountstoupdate.add(newaccount);
}}} 

Thankyou

Andrew
I am very new to Visualforce (last job had its own VF programmer, now I'm having to pick it up), and created a page that creates a list of items, and a button to access the page from the parent, in this case, contracts.  The related list is Contract Items (contract_item__c) and I would like to limit the contract items to only the ones related to the specific contract I launch the page from.  I'm sure this is answered somewhere, but I apparently do not know what I am looking for, as 2 days of searching has brought me close but not quite there.
 
<apex:page standardController="Contract_Item__c"
           recordSetVar="CI"
           tabStyle="Contract_Item__c" sidebar="false">
  <apex:form >
    <apex:pageBlock >
      <apex:pageMessages />
      <apex:pageBlockButtons >
        <apex:commandButton value="Save"
                            action="{!save}"/>
        <apex:commandButton value="Cancel"
                            action="{!cancel}"/>
      </apex:pageBlockButtons>
      <apex:pageBlockTable value="{!CI}"
                           var="c">
        <apex:column value="{!c.name}"/>
        <apex:column headerValue="Item">
          <apex:outputField value="{!c.Item__c}"/>
        </apex:column>
        <apex:column headerValue="Price">
          <apex:inputField value="{!c.FS_Price__c}"/>
        </apex:column>
        <apex:column headerValue="Rebate">
            <apex:inputField value="{!c.Rebate__c}"/>
        </apex:column>
        <apex:column headerValue="Volume">
          <apex:inputField value="{!c.FS_Volume__c}"/>
        </apex:column>
      </apex:pageBlockTable>     
    </apex:pageBlock>
  </apex:form>
</apex:page>


 
I've got a test method that I have hard coded a few Ids(Record Type, User and Account) into (I'm not very good at writing these).  I need to dynamically assign these but at a loss as to how. 

If I try to create a new user, there are fields that are required that I can't find field names for.  Accounts when we create them are big to-do's so I wouldn't even know where to begin to create that in a test method and then record types, again at a loss.  Can someone please help me?  I have google searched some examples for the user but my test run fails saying the user is invalid.

Here's my test method.  Any help would be greatly appreciated!
@isTest

private class CW_Validations_Status_UpdatesTest {
 
 
static testMethod void CWStatusValidationTest() {



Profile p = [SELECT Id FROM Profile WHERE Name='CW MineStar Support - Tier 2']; 
        
        
 User u1 = new User(Alias = 'standt', Email='standarduser@testorg.com', 
            EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
            LocaleSidKey='en_US', ProfileId = p.Id, 
            TimeZoneSidKey='America/Los_Angeles', UserName='stacitestuser@testorg.com');
            insert u1;

//creates a case record
Case cs1 = new Case();
cs1.RecordTypeId = '01230000000v4Ss';
cs1.AccountId = '00119000003QPkD';
cs1.OwnerId = 'u1';
cs1.Reason = 'Incident';
cs1.CW_Type__c = 'Product Support';
cs1.Impact__c = 'Site Production Down';
cs1.Urgency__c = 'Normal';
cs1.Status = 'Closed - Resolved';
cs1.Resolution_Detail__c = 'This case is resolved';
cs1.Defect_Type_Multi__c = 'Hardware';
cs1.Subject = 'This is my case';
cs1.Description = 'This is my description';
cs1.Incident_Start__c=Date.today();
cs1.Product__c = 'Fleet';
cs1.Application__c = '--';
cs1.Subsystem__c = 'Office';
cs1.Component__c = 'Database';
insert cs1;

cs1.Status = 'Closed - Duplicate';
cs1.Resolution_Detail__c = 'This case is a duplicate of 1234';
update cs1;

cs1.Status = 'Closed - Declined';
cs1.Resolution_Detail__c = 'This case has been declined by development';
cs1.Declined_Reason__c = 'Product is end of life';
cs1.Defect_Type_Multi__c = 'Hardware';
update cs1;

cs1.Status = 'Pending - Change';
cs1.Resolution_Detail__c = 'This case is awaiting a change';
cs1.Change_Number__c = 'aadsfaf23432';
cs1.Change_Tracking_Link__c = 'http://www.yahoo.com';
update cs1;

cs1.Status = 'Closed - No Response';
cs1.Resolution_Detail__c = 'This is closing no response';
cs1.Defect_Type_Multi__c = 'Hardware';
update cs1;


cs1.Status = 'Closed - Cancelled';
cs1.Resolution_Detail__c = 'This case is being cancelled, no longer needed';
update cs1;


cs1.Status = 'Closed - Unable to Reproduce';
cs1.Resolution_Detail__c = 'Closing case as we are not able to reproduce issue';
update cs1;


cs1.Status = 'Pending - RCA';
cs1.Workaround_ICA__c = 'This is a workaround';
update cs1;


cs1.Status = 'Pending - Dealer Validation';
cs1.Workaround_ICA__c = 'This is a workaround';
update cs1;


cs1.Status = 'Pending - Customer Validation';
cs1.Workaround_ICA__c = 'This is a workaround';
update cs1;


cs1.Status = 'Pending - NPI';
cs1.Workaround_ICA__c = 'This is a workaround';
cs1.NPI_Numbertext__c = 'fwefw2e3fr2w';
cs1.NPI_Tracking_Link__c = 'http://www.yahoo.com';
update cs1;

cs1.Status = 'Pending - CPI';
cs1.Workaround_ICA__c = 'This is a workaround';
cs1.CPI_Numbertext__c = '232r2df23';
cs1.CPI_Tracking_Link__c = 'http://www.yahoo.com';
update cs1;


cs1.Status = 'Recurring Incident';
cs1.Resolution_Detail__c = 'This is recurring incident';
cs1.ParentId = '50019000000dXO9';
update cs1;

cs1.Status = 'Pending - Evaluation';
cs1.Resolution_Detail__c = 'This is recurring incident';
update cs1;

}

static testMethod void CWUserValidationTest() {
//creates a case record, Owner Tier 2 Peoria user 
Case cs2 = new Case();
cs2.RecordTypeId = '01230000000uzis';
cs2.AccountId = '00119000003QPkD';
cs2.Reason = 'Incident';
cs2.CW_Type__c = 'Product Support';
cs2.Impact__c = 'Site Production Down';
cs2.Urgency__c = 'Normal';
cs2.Product__c = 'Fleet';
cs2.Application__c = '--';
cs2.Subsystem__c = 'Office';
cs2.Status = 'New';
cs2.Subject = 'This is my case';
cs2.Description = 'This is my description';
cs2.Incident_Start__c=Date.today();
cs2.OwnerId = 'u1';
insert cs2;

//updates owner to T3 Americas user
cs2.OwnerId = 'u2';
update cs2;

//updates owner to T2 APD user
cs2.OwnerId = 'u1';
update cs2;

//creates a case record, Owner Tier 2 queue
Case cs3 = new Case();
cs3.RecordTypeId = '01230000000uzis';
cs3.AccountId = '00119000003QPkD';
cs3.Reason = 'Incident';
cs3.CW_Type__c = 'Product Support';
cs3.Impact__c = 'Site Production Down';
cs3.Urgency__c = 'Normal';
cs3.Product__c = 'Fleet';
cs3.Application__c = '--';
cs3.Subsystem__c = 'Office';
cs3.Status = 'New';
cs3.Subject = 'This is my case';
cs3.Description = 'This is my description';
cs3.Incident_Start__c=Date.today();
cs3.OwnerId = '00G30000001oUSL';
insert cs3;

//update owner to T3 queue
cs3.OwnerId = '00G30000002jFoz';
update cs3;

//creates a case record, Owner Tier 2 queue
Case cs4 = new Case();
cs4.RecordTypeId = '01230000000uzis';
cs4.AccountId = '00119000003QPkD';
cs4.Reason = 'Incident';
cs4.CW_Type__c = 'Product Support';
cs4.Impact__c = 'Site Production Down';
cs4.Urgency__c = 'Normal';
cs4.Product__c = 'Fleet';
cs4.Application__c = '--';
cs4.Subsystem__c = 'Office';
cs4.Status = 'New';
cs4.Subject = 'This is my case';
cs4.Description = 'This is my description';
cs4.Incident_Start__c=Date.today();
cs4.OwnerId = '00G30000001oUSL';
insert cs4;

//update user to T2 user
cs4.OwnerId = 'u1';
update cs4;


//creates a case record, Owner Tier 2 user
Case cs1 = new Case();
cs1.RecordTypeId = '01230000000uzis';
cs1.AccountId = '00119000003QPkD';
cs1.Reason = 'Incident';
cs1.CW_Type__c = 'Product Support';
cs1.Impact__c = 'Site Production Down';
cs1.Urgency__c = 'Normal';
cs1.Product__c = 'Fleet';
cs1.Application__c = '--';
cs1.Subsystem__c = 'Office';
cs1.Status = 'New';
cs1.Subject = 'This is my case';
cs1.Description = 'This is my description';
cs1.Incident_Start__c=Date.today();
cs1.OwnerId = 'u1';
insert cs1;

//updates owner to T3 queue
cs1.OwnerId = '00G30000002jFoz';
update cs1;


//creates a case record, Owner is T2 queue
Case cs8 = new Case();
cs8.RecordTypeId = '01230000000uzis';
cs8.AccountId = '00119000003QPkD';
cs8.Reason = 'Incident';
cs8.CW_Type__c = 'Product Support';
cs8.Impact__c = 'Site Production Down';
cs8.Urgency__c = 'Normal';
cs8.Product__c = 'Fleet';
cs8.Application__c = '--';
cs8.Subsystem__c = 'Office';
cs8.Status = 'New';
cs8.Subject = 'This is my case';
cs8.Description = 'This is my description';
cs8.Incident_Start__c=Date.today();
cs8.OwnerId = '00G30000001oUSL';
insert cs8;

//update user to T3 user
cs8.OwnerId = '00530000004CgXz';
update cs8;


}

static testMethod void CWSubStatusUpdateTest(){
//creates a case record, T2 User is Owner
Case cs1 = new Case();
cs1.AccountId = '00119000003QPkD';
cs1.OwnerId = 'u1';
cs1.Reason = 'Incident';
cs1.CW_Type__c = 'Product Support';
cs1.Impact__c = 'Site Production Down';
cs1.Urgency__c = 'Normal';
cs1.Status = 'New';
cs1.Subject = 'This is my case';
cs1.Description = 'This is my description';
cs1.Incident_Start__c=Date.today();
cs1.Product__c = 'Fleet';
cs1.Application__c = '--';
cs1.Subsystem__c = 'Office';
insert cs1;

//change owner to Dealer user
cs1.OwnerId = '00519000000Ikmj';
update cs1;


//creates a case record, T2 queue as Owner
Case cs2 = new Case();
cs2.AccountId = '00119000003QPkD';
cs2.OwnerId = '00G30000001oUSL';
cs2.Reason = 'Incident';
cs2.CW_Type__c = 'Product Support';
cs2.Impact__c = 'Site Production Down';
cs2.Urgency__c = 'Normal';
cs2.Status = 'New';
cs2.Subject = 'This is my case';
cs2.Description = 'This is my description';
cs2.Incident_Start__c=Date.today();
cs2.Product__c = 'Fleet';
cs2.Application__c = '--';
cs2.Subsystem__c = 'Office';
insert cs2;

//change owner to T2 user
cs2.OwnerId = 'usr1';
update cs2;

//creates a case record, CW Admin queue as Owner
Case cs3 = new Case();
cs3.AccountId = '00119000003QPkD';
cs3.OwnerId = '00G30000002ljqO';
cs3.Reason = 'Incident';
cs3.CW_Type__c = 'Product Support';
cs3.Impact__c = 'Site Production Down';
cs3.Urgency__c = 'Normal';
cs3.Status = 'New';
cs3.Subject = 'This is my case';
cs3.Description = 'This is my description';
cs3.Incident_Start__c=Date.today();
cs3.Product__c = 'Fleet';
cs3.Application__c = '--';
cs3.Subsystem__c = 'Office';
insert cs3;

//changes user to CW Admin user
cs3.OwnerId = '005a0000007VK2P';
update cs3;

//creates a case record, T2 as Owner
Case cs5 = new Case();
cs5.AccountId = '00119000003QPkD';
cs5.OwnerId = 'u1';
cs5.Reason = 'Incident';
cs5.CW_Type__c = 'Product Support';
cs5.Impact__c = 'Site Production Down';
cs5.Urgency__c = 'Normal';
cs5.Status = 'New';
cs5.Subject = 'This is my case';
cs5.Description = 'This is my description';
cs5.Incident_Start__c=Date.today();
cs5.Product__c = 'Fleet';
cs5.Application__c = '--';
cs5.Subsystem__c = 'Office';
insert cs5;

//change case owner to customer user
cs5.OwnerId = '00519000000Jnwt';
update cs5;


//creates a case record, T2 user as Owner
Case cs6 = new Case();
cs6.AccountId = '00119000003QPkD';
cs6.OwnerId = 'u1';
cs6.Reason = 'Incident';
cs6.CW_Type__c = 'Product Support';
cs6.Impact__c = 'Site Production Down';
cs6.Urgency__c = 'Normal';
cs6.Status = 'New';
cs6.Subject = 'This is my case';
cs6.Description = 'This is my description';
cs6.Incident_Start__c=Date.today();
cs6.Product__c = 'Fleet';
cs6.Application__c = '--';
cs6.Subsystem__c = 'Office';
insert cs6;

//change case owner to T3 user
cs6.OwnerId = 'u2';
update cs6;

//creates a case record, T2 user as Owner
Case cs7 = new Case();
cs7.AccountId = '00119000003QPkD';
cs7.OwnerId = 'u1';
cs7.Reason = 'Incident';
cs7.CW_Type__c = 'Product Support';
cs7.Impact__c = 'Site Production Down';
cs7.Urgency__c = 'Normal';
cs7.Status = 'Closed - Resolved';
cs7.Subject = 'This is my case';
cs7.Description = 'This is my description';
cs7.Incident_Start__c=Date.today();
cs7.Product__c = 'Fleet';
cs7.Application__c = '--';
cs7.Subsystem__c = 'Office';
cs7.Component__c = 'Client';
cs7.Resolution_Detail__c = 'this is the resolution detail';
cs7.Defect_Type_Multi__c = 'Configuration';
insert cs7;

}}

 
  • December 29, 2015
  • Like
  • 0
Thought this challenge was pretty straight forward, but I'm not sure what to do based on the error message; here is the challenge copy&paste:

Create an Apex class that returns an array (or list) of formatted strings ('Test 0', 'Test 1', ...). The length of the array is determined by an integer parameter.The Apex class must be called 'StringArrayTest' and be in the public scope.
The Apex class must have a public static method called 'generateStringArray'.
The 'generateStringArray' method must return an array (or list) of strings. Each string must have a value in the format 'Test n' where n is the index of the current string in the array. The number of returned strings is specified by the integer parameter to the 'generateStringArray' method.




Here's my Apex Class:


public class StringArrayTest {
    public static String[] generateStringArray(Integer n) {
        String[] s = new List<String>();
        for(Integer i = 0; i < n; i++) {
            s.add('Test' + i);
        }
        return s;
    }
}

And here's the error message upon checking that class upon:

Executing the 'generateStringArray' method failed. Either the method does not exist, is not static, or does not return the proper number of strings.
Hi all,

I have a controller that allows a contact in a specific campaign to be generated with a click of a button. Every time the button is clicked a new contact will be generated.

I now need a way making sure that contact cant be selected again. Ideally there would be another button that has a list of the contacts that have been generated.

Any help on this would be much appreciated. Thank you

Controller:
public class MascotController 
{
   public List<Contact> contacts{get;set;}

   public MascotController()
   {
        getContacts();
   }

   public void getContacts()
   {
        Integer count = [SELECT COUNT() FROM Contact];
        Integer rand = Math.floor(Math.random() * count).intValue();
        Set<Id> contactIds = new Set<Id>();
        contacts = new List<Contact>();

        for(CampaignMember cm : [Select Id, ContactId from CampaignMember where Status = 'To be Called' and Campaign.Name = '2014/15 Mascot Data'])
        {
           contactIds.add(cm.ContactId);
        }
        List<String> orderBys = new List<String>{'Email Asc','Email Desc','Lastname Asc','Firstname Desc','LastModifiedDate Desc','LastModifiedDate Asc','CreatedDate Asc','CreatedDate Desc','Id Asc','Id Desc'};

        String orderBy = orderBys.get(Math.mod(rand,orderBys.size()));

        contacts = Database.query('Select Name From Contact where ID in :contactIds Order By ' + orderBy + ' Limit 1 OFFSET :rand');
    }
}

VF Page:
<apex:page showHeader="true" sideBar="true" controller="MascotController">
   <apex:form >
      <apex:pageblock id="pb" title="Mascot Winner">
         <apex:commandButton value="Generate Winner" action="{!getContacts}" rerender="randomContacts"/> 
         <apex:outputPanel id="randomContacts">
          <apex:pageblock > 
              <apex:PageBlockTable value="{!contacts}" var="item">
                  <apex:column headerValue="Contact Name" value="{!item.Name}"/>
              </apex:PageBlockTable>  
           </apex:pageblock> 
         </apex:outputPanel>
      </apex:pageBlock>
   </apex:form>
</apex:page>

 
I have a before update trigger on the opportunity. I would like to count the number of contact roles on each opportunity in the trigger as well as indicate on the opportunity if at least one of the contact roles is flagged as a primary contact.

My original solution used a SOQL for loop inside a for loop and was running through my governor limits:
trigger ContactRole on Opportunity (before update) {

for (Opportunity o : trigger.new) {
        Integer count = 0;
        Boolean hasPrimary = FALSE;
        for (OpportunityContactRole ocr : [SELECT Id, isPrimary 
                                           FROM OpportunityContactRole 
                                           WHERE OpportunityId =:o.Id]) {
            count++;
            if (ocr.isPrimary)
                hasPrimary = TRUE;
    	}
		
        o.Number_of_Contact_Roles__c = count;
        o.Has_Primary_Contact__c = hasPrimary; 
    }
}

So I've created this work around. The problem is that the last 2 lines that should update 2 fields on the opportunity aren't updating the opportunity. In my debug log it shows that the fields are being updated but those changes aren't being written to the database. I'm sure there's a simple solution here that I'm not seeing. Thanks for your help.
for (Opportunity o : [SELECT Id, Has_Primary_Contact__c, Number_of_Contact_Roles__c, 
    					  (SELECT Id, isPrimary FROM OpportunityContactRoles)
    					  FROM Opportunity WHERE Id IN :trigger.newMap.keyset()]) {
    	Integer count = 0;
		Boolean hasPrimary = False;
        for (OpportunityContactRole ocr : o.OpportunityContactRoles) {
        	count++;
            if (ocr.isPrimary)
                hasPrimary = TRUE;
        }
        
        o.Number_of_Contact_Roles__c = count;
        o.Has_Primary_Contact__c = hasPrimary;
		System.debug('opportunity: ' + o);
	}

 
Contact is parent and Case is child and am trying to run the following query.
Contact__c c=[Select Id, Name, (select Name from Case__r ) from Contact__c];

but query is gving me below error.

Didn't understand relationship 'Case__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.

i tried same kind of query for my another app it's working. y not here? errrrrrrrrrrrrrrrrr
Please find the below trigger ...getting below error " Initial term of field expression must be a concrete SObject: LIST<Account>"

Could you please let me know what is this error ?

trigger AccountDuplicate on Account (before insert, before update)
{
    for(Account a:Trigger.new)
    {
        List<Account> acc =[select id, Name from Account where Name=:a.Name];
        if(acc.size()>0)
        {
        acc.Name.addError('You Cannot Create the Duplicate Account');
        }
    }
}

we have one add account button and del button at time for page load 
When the user click on the add new account then few fields ex: Account name ,Industry and Rating are show with inputFields so the user can
enter the user value and then two more button are display on page to add the contact for that account and delete the contact for that account.
For example one account with multiple contact on row.I have try but actully i have used the two pageblocktable with the Map in which i receive the value in one pageblocktable but when i am using the contact value in pageblocktable it is given the error i.e Map key null not found in map.
I am sharing the code ...

Visualforce page*************

<apex:page controller="Addcontactwrappernewcontroller">
 <apex:form >
   <apex:commandButton value="Add Account" action="{!addaccount}" rerender="panel"/>
    <apex:pageBlock >
    <apex:pageBlockSection columns="2">
     <apex:pageBlockTable var="key" value="{!mywrapperobj}">
      <apex:column headerValue="Account Name">
       <apex:inputField value="{!mywrapperobj[key].accobj.Name}"/>
      </apex:column>
      <apex:column headerValue="Rating">
       <apex:inputField value="{!mywrapperobj[key].accobj.Rating}"/>
      </apex:column>
      <apex:column headerValue="Type">
       <apex:inputField value="{!mywrapperobj[key].accobj.Type}"/>
      </apex:column>
      </apex:pageBlockTable>
     <apex:pageBlockTable var="innerListVar" value="{!mywrapperobj[key].conlist}">
      <apex:column headerValue="Last Name">
       <apex:inputField value="{!innerListVar.LastName}"/>
      </apex:column>
     </apex:pageBlockTable>
    </apex:pageBlockSection>
    </apex:pageBlock>
 </apex:form>
</apex:page>


Controller***********

public with sharing class Addcontactwrappernewcontroller {

    public String getKey() {
        return null;
    }


   
    public Integer counter {get;set;}
    public Integer row {get;set;}
    public Map<Integer,wrapperclass> mywrapperobj {get;set;}

    public class wrapperclass{
    
    public List<Contact> conlist{get;set;}
    public Account accobj{get;set;}
    public wrapperclass(){
    this.conlist = new List<Contact>();
    this.accobj = new Account();
     }
   }

    public Addcontactwrappernewcontroller(){
    counter = 0;
    mywrapperobj = new Map<Integer,wrapperclass>();
    addaccount();
   }

   public void addaccount(){
   counter ++;
   mywrapperobj.put(counter,new wrapperclass());
   row=counter;
   addcontactRow();
   }

   public void addcontactRow(){
   mywrapperobj.get(row).conlist.add(new Contact());
   }
    
}


Thanks in advance 
For account there is related list of contacts. I want to know that how many contacts are there for that account.
Query should be Parent To Child like  
" SELECT Name, ( SELECT LastName FROM Contacts ) FROM Account"
Use Case: because I want to write trigger on Account and limits that for every account should not more than 3 contacts.

Thanks in advance.
Hi Fnds..

 In my organation i have one profile is CanadaUsers, i have send a Email to user's Reset your password with link.

Example:: Adminin can send individuals user's resetpassword link when click on Resetpassword button on profile and check the checkbox for user

like above i can send emails to all user's in particular profile


Thanks in Advance
Nnr
 
  • December 27, 2014
  • Like
  • 0
I have created a custom escalate button that updates the Case Status to "Escalated" and ultimately triggers an assignment rule. However, the updated status doesn't display or trigger the assignment rule until I manually edit and save that case. Is there a way to add javascript code to my escalate button that will trigger an automatic edit/save cycle or is there a better way to do this?

Thanks in advance.

Steve
Hello!
I am trying to create a new template but everytime i try to reference the opportunity I get this.
Error: Unknown property 'core.email.template.EmailTemplateComponentController.Opportunity

Here is the code:
<messaging:emailTemplate subject="WeddingWire Receipt" recipientType="Contact" relatedToType="Opportunity">
<messaging:htmlEmailBody >

<p style="font-family: Helvetica, Arial, sans-serif; font-size: 12px">Hi {!recipient.name},</p>
<p style="font-family: Helvetica, Arial, sans-serif; font-size: 12px">Congratulations! You now have access to premium WeddingWire benefits. Your order has been processed successfully. Here are the details:
</p>
<p style="font-family: Helvetica, Arial, sans-serif; font-size: 12px">
<strong>Confirmation Number: </strong><apex:outputField value="{!Opportunity.Transaction_ID__c}"/>
<br></br>
<strong>Product:</strong>
<br></br>
<br></br>
<strong>Total Contract Value: </strong>
<br></br>
<br></br>
<strong>Sales Price: </strong>{!Opportunity.Amount}
<br></br>
<strong>Payment Plan: </strong>
<br></br>
<strong>Installment Amount:  </strong>
<br></br>
<strong>Sales Rep: </strong>
<br></br>
<strong>Term: </strong>12 Months
<br></br>
<br></br>

'
Hi,

I'd be very grateful if someone could help me with my query. (Note that I'm a Salesforce newbie). I've imported data from an external public service reports system. I cleaned the data in the csv and created a new custom object in SF before I imported the csv using the Apex data loader. The import was successful but I can't find the data!

I have a new lookup field in 'Case' to connect to the new custom object but I think it should be the other way around?

The end goal is to be able to view all reports that I imported with their custom fields correctly mapped and then also to be able to create new 'Cases', but with all the new fields available to me to input information...in other words "I want to replace Cases with my new custom object called 'Incidents'. I then wish to assign staff in different depots to these cases/incidents, but that's at a later stage.

Any help would be greatly appreciated. Thank you,

Stephen

P.S. I can send you a small sample of the csv I imported if that helps? 
Hi experts,

Requirement: I have 2 objects: Account(Standard) and Cobject(Custom object). Account and Cobject has a master-detail relationship. So, on Account Detail Page, we have Cobject as related list. In the relatedlist, 'NEW' button of cObject is overridden by a VisualForce Page. My query is- How can I get the AccountId for the Cobject that I am creating on clicking 'NEW' button? Please help with the syntax.

I have tried to get the AccountId from the URL. But, URL shows only 15 digits in the UI. If we take this 15 digits ID, then on assiging the 15 digits ID in the Custom field(for M-D relation) , throws an error, saying- INVALID ID.

Here, we need to get the 18 digit AccountID for which new Cobject record is creating. Please help

Thanks,
Kaity

 
  • December 25, 2014
  • Like
  • 0
Hi! I have a trigger that runs when records are updated (before update). I want it to also run after insert, for new records, but I'm not sure how.

Here's the trigger:
trigger AddPrimaryContactToOpp on Opportunity (before update) {
// THIS TRIGGER WILL OVERWRITE ANY CONTACT DEFINED IN THE CUSTOM FIELD OPPORTUNITY_CONTACT__C ON THE OPPORTUNITY OBJECT.
// SET THIS FIELD TO READ ONLY OR CHANGE THE FUNCTIONALITY BELOW TO AVIOD DATA BEING OVERWRITTEN BY MISTAKE...
   for (Opportunity o : Trigger.new) {	
       // CREATE ARRAY OF ALL CONTACT ROLES ON THIS OPPORTUNITY. THE REASON WHY WE DONT PICK THE PRIMARY CONTACT ROLE ONLY
       // IS BECAUSE THE PRIMARY FLAG IS NOT SET WHEN LEADS ARE CONVERTED TO OPPORTUNITIES. ONLY WHEN CREATING OPPORTUNITIES
       // MANUALLY FROM THE CONTACT OBJECT THE IS PRIMARY CHECKBOX IS CHECKED...
      
       OpportunityContactRole[] contactRoleArray =
       [select ContactID, isPrimary from OpportunityContactRole where OpportunityId = :o.id ORDER BY isPrimary DESC, createdDate];
       system.debug('>>> contact role array is ' + JSON.serialize(contactRoleArray));
       if (contactRoleArray.size() > 0) {
         
           // IF PRIMARY IS DEFINED THEN THIS WILL BE THE FIRST OBJECT. IF NOT THE FIRST ADDED CONTACT ROLE WILL BE ADDED...
           o.Contact__c = contactRoleArray[0].ContactID;
          
       }
       system.debug('>>> contact__c is ' + o.Contact__c);
   }
 }
Adding before insert didn't work because the OCRs are not yet created. Adding after insert didn't work either - it gave an error.

Any ideas? Thanks!

PS: this code is not bulkified (I think), so I'd love to take care of that too!
 
In the wrapper class (which I am using and not even really sure I HAVE to), I am getting data from Accounts, contacts, and 2 custom objects. In my vf page I have 5 different sections - 1 updates account data, one updates information from both custom objects, one updates info for just one of the custom objects, one updates contacts, and one updates accounts again - but using a wrapper to get the parent accounts.

I have figured out the easiest part (updating the first account section) but cannot for the life of me figure out how to save data (from an inline edit) back to the other objects (I have not tried contacts, just trying to get the custom objects).

Here is my class extension (page uses standard account controller with this extension).
public with sharing class RoadMapAccount {

    private final Account account;
    public list<wrapperclass> accountlist1wrap { get; set; }
    public list<wrapperclass> purchasedwrap{ get; set; }
    public list<wrapperclass> implementedwrap { get; set; }
    public list<wrapperclass> plannedwrap{ get; set; }
    public list<wrapperclass> roadmapwrap { get; set; }
    public list<wrapperclass> contactwrap { get; set; }
         
        
    public RoadMapAccount(ApexPages.StandardController controller) {

        account = [Select Id, Name, Product_Interested__c, Account_Management_Type__c,
        Overall_Status__c, Opportunity_Order_Status__c, NPS_Status__c,Case_Status_Stoplight__c,
        MSA_Status__c, Risk_Status__c, Version_Status__c, Team_Management_Status__c, Escalate_Button__c,
        Wall_of_Success__c, Escalated_Reason__c, Account_Alias__c, parentid, parent_install__c, type,
        Parent.Name,Parent_Install__r.Name,(Select Id, Product_Status__c From MC_Assets__r)
         From Account where Id = :ApexPages.currentPage().getParameters().get('id')];
        
         list<Account> object0 = [
         Select parentid, parent_install__c, Account_Alias__c, Type, Name,
        Parent.Name,Parent_Install__r.Name
         from Account
         WHERE parentid =:account.Id OR parent_install__c =:account.Id];

         list<MC_Products__c> object1 = [
            Select Product_Status__c, Id, Name 
            From MC_Products__c
            WHERE Account__c =:account.Id]; 

        list<IS_RoadMap__c> object2 = [
            Select Id, Depts_using_Training__c, Depts_using_Documents__c, Account_Name__c,
            Product_Planned_to_Purchase__c, Phase_date__c, Depts_using_Risk__c,
            Depts_using_Supplier__c, Depts_using_Audit__c, Depts_using_Process__c, Next_Phase_Implementation_Notes__c,
            Account_Strategy__c, Current_System_concerns__c, Key_Individuals__c 
            From IS_RoadMap__c  
            WHERE Account_Name__c =:account.Id];

        list<Contact> object3 = [
        Select Id, AccountId, LastName, FirstName, Email, Title, Department_Contact__c, Viewed_Harbor_Tour__c
        From Contact
        WHERE AccountId =:account.Id];

        accountlist1wrap = new list<wrapperclass>();
        for(Account obj0: object0){
            accountlist1wrap.add(new wrapperclass(obj0));
        }            

        purchasedwrap = new list<wrapperclass>();
        for(MC_Products__c obj1: object1){
        	if(obj1.Product_Status__c == 'Purchased')
            purchasedwrap.add(new wrapperclass(obj1));
        }
        implementedwrap = new list<wrapperclass>();
        for(MC_Products__c obj1: object1){
        	if(obj1.Product_Status__c == 'Implemented')
            implementedwrap.add(new wrapperclass(obj1));        
        }
        plannedwrap = new list<wrapperclass>();
        for(MC_Products__c obj1: object1){
          if(obj1.Product_Status__c == 'Plan to Implement')
            plannedwrap.add(new wrapperclass(obj1));        
        }
        roadmapwrap = new list<wrapperclass>();
        for(IS_RoadMap__c obj2: object2){
            roadmapwrap.add(new wrapperclass(obj2));
        }
        contactwrap = new list<wrapperclass>();
        for(Contact obj3: object3){
            contactwrap.add(new wrapperclass(obj3));
        }

     }    

    

    public class wrapperclass{
        public Account object_0{get;set;}
        public MC_Products__c object_1{get;set;}
        public IS_RoadMap__c object_2{get;set;}
        public Contact object_3{get;set;}        

        public wrapperclass(Account obj0){
            this.object_0 = (obj0);
        }
         public wrapperclass(MC_Products__c obj1){
            this.object_1 = (obj1);
        }
        public wrapperclass(IS_RoadMap__c obj2) {
            this.object_2 = (obj2);
        }
        public wrapperclass(Contact obj3) {
            this.object_3 = (obj3);
        }  
}
    

	public Account getaccount() {
        return account;    
     } 
    public void saveRM()
    { account.RoadMap__c=True;
        try{   
        update account; 
     
        }
        catch(Exception e)
        {
        }
    }
        public boolean roadmap {
        get {
            return [
                    select Roadmap__c
                    from Account
                    where Id =:account.Id
                    ].Roadmap__c;
        }
    }
    public void saveacc()
    {
        try{   
        update account;
        
     
        }
        catch(Exception e)
        {
        }
    }            
 
}

Visual force page (this will eventually be a "tab" on a custom account page.) (all save buttons, other than the first one, are just there as place holders - I know they are not configured correctly)
<apex:page Standardcontroller="Account" extensions="RoadMapAccount"
            sidebar="false" showheader="false">
            <base target="_parent" />

<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"/>
<script>
    j$ = jQuery.noConflict();
    
    function showLoadingDiv() {
        var newHeight = j$("[id$=lead-edit-section] .pbSubsection").css("height");//Just shade the body, not the header
        j$("[id$=loading-curtain-div]").css("background-color", "black").css("opacity", 0.35).css("height", newHeight).css("width", "80%");
    }
    function hideLoadingDiv() {
        j$("[id$=loading-curtain-div]").css("background-color", "black").css("opacity", "1").css("height", "0px").css("width", "80%");
    }
    
   function pageScroll() {
        window.scrollBy(0,400); // horizontal and vertical scroll increments
        
    }
 </script> 
 <style>
 input.btn { 
     color:#050; 
     font: bold 84% 'trebuchet ms',helvetica,sans-serif; 
     background-color:#fed; 
     border:1px solid; 
     border-color: #696 #363 #363 #696; 
   }
 </style>   
    <apex:form >
 <apex:pageblock title="RoadMap">
                    <apex:pageBlock rendered="{!Not (roadmap)}">
                <apex:pageBlockButtons location="top" >
                     <apex:commandbutton onclick="pageScroll()" value="Create RoadMap" action="{!saveRM}"  id="rmbutton" />
                </apex:pageBlockButtons><br />
                <apex:pageMessage summary="Click 'Create RoadMap' to get started" severity="info" strength="3" />
                   </apex:pageBlock>   

    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="account-edit-block">
        <apex:actionStatus id="save-account-status"/>
          <apex:pageBlockSection title="Account Information" columns="2" collapsible="false" id="account-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem>
            <apex:outputField value="{!account.name}">
            <apex:inlineEditSupport event="onclick"/>
            </apex:outputfield> 
            <apex:outputField value="{!account.Account_Alias__c}">
            <apex:inlineEditSupport event="onclick"/>
            </apex:outputfield> 
            <apex:outputField value="{!account.type}">
            <apex:inlineEditSupport event="onclick"/>
            </apex:outputfield> 
          </apex:pageBlockSection>
            <center><apex:commandButton action="{!saveacc}" value="Save Account Information" status="save-account-status" rerender="account-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion>  

<apex:outputpanel id="fullmap">
     <apex:outputpanel rendered="{!roadmap}">

    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="product-edit-block">
        <apex:actionStatus id="save-product-status"/>
          <apex:pageBlockSection title="Product Details" id="product-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem>
            <apex:panelGrid columns="2" width="1350px">
        <apex:pageblock >
         <apex:pageblocktable value="{!purchasedwrap}" var="pur" id="Pdetails">
          <apex:column headerValue="Purchased">
          <apex:repeat var="a" value="{!pur.object_1}">
          <apex:outputText value="{!a.name}"/>
           </apex:repeat>
          </apex:column>         
          <apex:column headerValue="Status">
          <apex:repeat var="a" value="{!pur.object_1}">
          <apex:outputField value="{!a.Product_Status__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>   
        </apex:pageblocktable>
       </apex:pageblock>

        <apex:pageblock >
         <apex:pageblocktable value="{!implementedwrap}" var="imp" id="Idetails">
          <apex:column headerValue="Implemented">
          <apex:repeat var="a" value="{!imp.object_1}">
          <apex:outputText value="{!a.name}"/>
           </apex:repeat>
          </apex:column>         
          <apex:column headerValue="Status">
          <apex:repeat var="a" value="{!imp.object_1}">
          <apex:outputField value="{!a.Product_Status__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>   
          </apex:pageblocktable>
         </apex:pageblock>

        <apex:pageblock mode="inlineEdit" >
         <apex:pageblocktable value="{!plannedwrap}" var="pln" id="PIdetails">
          <apex:column headerValue="Planned to Implement">
          <apex:repeat var="a" value="{!pln.object_1}">
          <apex:outputText value="{!a.name}"/>
           </apex:repeat>
          </apex:column>         
          <apex:column headerValue="Status">
          <apex:repeat var="a" value="{!pln.object_1}">
          <apex:outputField value="{!a.Product_Status__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>
         </apex:pageblocktable>
        </apex:pageblock>

        <apex:pageblock >
         <apex:pageblocktable value="{!roadmapwrap}" var="rm" id="PPdetails">
          <apex:column headerValue="Products Planned Purchased">
          <apex:outputfield value="{!rm.object_2.Product_Planned_to_Purchase__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          <apex:column headerValue="Phase Date">
          <apex:outputfield value="{!rm.object_2.Phase_date__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>          
          </apex:column>
          <apex:column >
          <apex:commandbutton value="Remind Me" action="/00T/e?what_id={!account.Id}&tsk12=Not Started&retURL=%2Fa{!account.Id}"/>
          </apex:column>
          </apex:pageblocktable>
         </apex:pageblock>
        </apex:panelGrid>
       </apex:pageBlockSection>
         <center><apex:commandButton action="{!save}" value="Save Product Information" status="save-product-status" rerender="product-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion> 



    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="dept-edit-block">
        <apex:actionStatus id="save-dept-status"/>
          <apex:pageBlockSection title="Department Information" id="dept-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem>
                <apex:panelGrid columns="6" width="1350px">

        <apex:pageblock mode="inlineEdit" >
         <apex:pageblocktable value="{!roadmapwrap}" var="rmd" id="depts1">
           <apex:column headerValue="Depts using Documents">
          <apex:outputfield value="{!rmd.object_2.Depts_using_Documents__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rmp" id="depts2">
           <apex:column headerValue="Depts using Process">
          <apex:outputfield value="{!rmp.object_2.Depts_using_Process__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rmt" id="depts3">
           <apex:column headerValue="Depts using Training">
          <apex:outputfield value="{!rmt.object_2.Depts_using_Training__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rma" id="depts4">
           <apex:column headerValue="Depts using Audit">
          <apex:outputfield value="{!rma.object_2.Depts_using_Audit__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rms" id="depts5">
           <apex:column headerValue="Depts using Supplier">
          <apex:outputfield value="{!rms.object_2.Depts_using_Supplier__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>

         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="rmr" id="depts6">
           <apex:column headerValue="Depts using Risk">
          <apex:outputfield value="{!rmr.object_2.Depts_using_Risk__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>
         </apex:panelGrid> <br />
                <apex:panelGrid columns="1" width="1350px">
         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="n" id="notes">
           <apex:column headerValue="Next Phase Implementation Notes">
          <apex:outputfield value="{!n.object_2.Next_Phase_Implementation_Notes__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         </apex:pageblock>
                                                      
         </apex:panelGrid>
      </apex:pageBlockSection>
         <center><apex:commandButton action="{!save}" value="Save Dept Information" status="save-dept-status" rerender="dept-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion> 

    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="strat-edit-block">
        <apex:actionStatus id="save-strat-status"/>
          <apex:pageBlockSection title="Account Notes and Account Strategy" id="strat-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem>
            <apex:panelGrid columns="1" width="1350px">
        <apex:pageblock title="Associated Contacts" mode="inlineEdit">
         <apex:pageblocktable value="{!contactwrap}" var="con" id="contact">
          <apex:column headerValue="Name">
          <apex:repeat var="c" value="{!con.object_3}">
          <apex:outputlink value="{c.id}"><apex:outputField value="{!c.FirstName}"/><apex:outputField value="{!c.LastName}"/></apex:outputlink>
          </apex:repeat>
          </apex:column>  
          <apex:column headerValue="Title">
          <apex:repeat var="c" value="{!con.object_3}">
          <apex:outputField value="{!c.title}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>   
          <apex:column headerValue="Department">
          <apex:repeat var="c" value="{!con.object_3}">
          <apex:outputField value="{!c.Department_Contact__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column>   
          <apex:column headerValue="Email">
          <apex:repeat var="c" value="{!con.object_3}">
          <apex:outputField value="{!c.email}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>              
          </apex:repeat>
          </apex:column> 
         <apex:column headerValue="Viewed Harbor Tour" value="{!con.object_3.Viewed_Harbor_Tour__c}" />
          </apex:pageblocktable>
         </apex:pageblock>
         <apex:pageblock mode="inlineEdit">
         <apex:pageblocktable value="{!roadmapwrap}" var="k" id="key">
           <apex:column headerValue="Key Individuals (Team details/concerns, Political layout, Newsletter Opt out…)">
          <apex:outputfield value="{!k.object_2.Key_Individuals__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         <apex:pageblocktable value="{!roadmapwrap}" var="c" id="current">
           <apex:column headerValue="Current System concerns or issues (General)">
          <apex:outputfield value="{!c.object_2.Current_System_concerns__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
         <apex:pageblocktable value="{!roadmapwrap}" var="s" id="strat">
           <apex:column headerValue="Account Strategy (Ex: Expand usage of Docs by expanding department, then focus on Training. Ex: Key Executive sponsor(s) and Champion who can expand through company)">
          <apex:outputfield value="{!s.object_2.Account_Strategy__c}">
          <apex:inlineEditSupport event="onclick"/>
          </apex:outputfield>
          </apex:column>         
          </apex:pageblocktable>
          </apex:pageblock>
         </apex:panelGrid>
       </apex:pageBlockSection>
         <center><apex:commandButton action="{!save}" value="Save Strategy Information" status="save-strat-status" rerender="strat-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion> 
 
    <apex:pageMessages />
     <apex:actionRegion >
      <apex:pageBlock id="parent-edit-block">
        <apex:actionStatus id="save-parent-status"/>
          <apex:pageBlockSection title="Associated Accounts - Children and Non-Install" id="parent-edit-section">
            <div></div>
            <apex:pageblockSectionItem ></apex:pageblockSectionItem> 
                <apex:panelGrid columns="1" width="1350px">
        <apex:pageblock mode="inlineEdit" rendered="{!AND(NOT(ISNULL(accountlist1wrap)),accountlist1wrap.size>0)}">
         <apex:pageblocktable value="{!accountlist1wrap}" var="par" id="parent">
          <apex:column headerValue="Account Name">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.Name}"/>
           </apex:repeat>
          </apex:column>
          <apex:column headerValue="Account Alias">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.Account_Alias__c}"/>
           </apex:repeat>
          </apex:column>
          <apex:column headerValue="Account Type">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.type}"/>
           </apex:repeat>
          </apex:column>          
          <apex:column headerValue="Parent">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.parent.name}"/>
           </apex:repeat>
          </apex:column>  
          <apex:column headerValue="Parent Install">
          <apex:repeat var="p" value="{!par.object_0}">
          <apex:outputText value="{!p.Parent_Install__r.name}"/>
           </apex:repeat>
          </apex:column>      
          </apex:pageblocktable>
         </apex:pageblock>
        <apex:pageBlock rendered="{!OR(ISNULL(accountlist1wrap),accountlist1wrap.size=0)}">
          <apex:pageMessage summary="This account is not the Parent or Parent Install on any other accounts." severity="info" strength="3" />
         </apex:pageBlock>
         </apex:panelGrid>
        </apex:pageBlockSection>
         <center><apex:commandButton action="{!save}" value="Save Parent Information" status="save-parent-status" rerender="parent-edit-block"/></center>
     </apex:pageBlock>
    </apex:actionRegion> 
   </apex:outputpanel>             
</apex:outputpanel>   
 </apex:pageblock>        
    </apex:form>
</apex:page>

 
(Note: I also posted in the Success forums but was told to post here.)

Hi, I am trying to create a SOQL query that shows Rep directors and quantities sold of select item from sales orders, which are somehow tied to accounts and are tied to rep directors.  I am not quite sure and that's the problem!  I want to see how good of a job the reps are in selling select items.   I can't run a Report because the data types don't seem to be connected so I am hoping I can use SOQL Query on Work Bench.

Note: I only know the basics with SOQL and I am not a Sales Force Admin.  Feel free to dumb down any replies!

I have tried three queries that I would think might work but don't (see below.)
I included hopefully more information that is necessary below and hopes someone can provide a query that would work. (see further below.)

These don't work.

1
SELECT Rep_Director__C, ( SELECT Description__c, Order_Quantity__c, Stock_Code__c FROM Order_Detail__C WHERE Stock_Code__C = ‘6195’ ) FROM Order_Header__r.Account__c
Error-“First SObject of the FROM statement must be a valid SObject type.”

2
SELECT Rep_Director__C, ( SELECT Description__c, Order_Quantity__c, Stock_Code__c FROM Order_Detail__C WHERE Stock_Code__C LIKE = ‘6195’ ) from Order_Header__C
Error-“Bind variables only allowed in Apex code”

3
SELECT Description__c, Order_Header__C, Order_Quantity__c, Stock_Code__c, ( SELECT Rep_Director__C from Order_Detail__c.Order_Header__c ) FROM Order_Detail__C WHERE Stock_Code__C LIKE ‘6195’

“Due to issues rendering query results, parent relationship queries are disabled by default. If you understand these limitations, parent relationship queries can be enabled under Settings. Alternatively, parent relationship queries can be run with REST Explorer under the Utilities menu without issue.”

When I change the settings it says
“Didn’t understand relationship ‘Order_Detail__c.Order_Header__c’ in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the ‘__r’ after the custom relationship name. Please reference your

->Some information that might be helfpul.

I In SalesForce

1 If I go to Build-Create-Objects-Sales Order, under Custom Fields & Relationships it says
Field Name-Account
API Name-Account C
Data Type-Master-Detail(Account)

Field Name-Rep Director
API Name-Rep_Director__c
Data Type-Text(3)

It also says Account is Master Object for Sales Order

2 If I go to Build-Create-Objects-Sales Order Line, under Custom Fields & Relationships it says
Field Label-Order Header
API Name-Order_Header__C
Data Type-Master-Detail(Sales Order)

It also says Sales Order is Master Object for Sales Order Line

II In Workbench, if I go to Standard & Custom Objects

1 Account-it says this under Child Relationships:
Order_Header__c.Account__c
-cascadeDelete: true
-childSObject: Order_Header__c
-deprecatedAndHidden: false
-field: Account__c
-relationshipName: Orders__r

For Account-it says this under Fields:
Rep_Director__c

2 Order_Header__c-it says this under Child Relationships:
Order_Detail__c.Order_Header__c
-cascadeDelete: true
-childSObject: Order_Detail__c
-deprecatedAndHidden: false
-field: Order_Header__c
-relationshipName: Order_Detail__r

3 Order_Detail__C-It says this under Fields
Order_Header__c

Thanks!
Hi,
I tried like below but its not working
BUTTON CODE:
----------
{!REQUIRESCRIPT("/soap/ajax/26.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/26.0/apex.js")}
var result = sforce.apex.execute('MyClass', 'myMethod', {Accountid:'{!Account.Id}'});
Alert('More than one contact not allowed'+result);
Class:
======
 webService static String myMethod(ID Accountid) {
String BusinessAccountid = Businessaccount.id;
String Errorstring='More than one contact not allowed';
List<Contact> checkBusinessAccountContactList=[SELECT id FROM Contact WHERE Accountid = :BusinessAccountid];
                System.debug(checkBusinessAccountContactList);
                Account BusinessAccountrelatedContacts=new Account();
                if(checkBusinessAccountContactList.size() > 1)
                {
                   return Errorstring;
                }

}
help me..
I am trying to redirect to specific record type's edit page layout of an object. Redirection works in Full salesforce site but not Salesforce1. I tried below function to redirect the page in Salesforce1. But it doesn't work, it always displays default record type's page layout of the object
sforce.one.navigateToURL("/006/e?RecordType=01280000000UIuJ&nooverride=1",true);
I tried redirecting the page by below way.Redirection hapens in Salesforce1 but it displays the page of full salesforce site. Please advise how to achieve this
window.location.href="/006/e?RecordType=01280000000UIuJ&nooverride=1";

 
I have overridden Standard New button for an object.This Object has two record types. Page layout corresponding to the Record type I selected is displayed in full Salesforce site which is the desired behavior. Whereas in Salesforce1 app, always default record type is displayed irrespective of the record type selection.Please help
I need to access images from external system using HTTP callouts and display them in Salesforce.
Content-Type →image/png is the format of the reponse Salesforce is receiving
Can we use Blob to store images?
Could anyone throw light on this
I have created a lightning app with a text box and list of contacts under it.As user types in the search string,List contents should be filtered.But I am receiving following error upon typing the search string-rerender threw an error in 'markup://aura:iteration' : Cannot read property 'childNodes' of null.I came across-"http://salesforce.stackexchange.com/questions/71604/lightning-bug-in-lightning-framework-when-using-aurarenderif" but not sure if it is the same reason for this behavior.Could anyone point out the error in my below code.

Component to display list of filtered contacts-ContactItemList.cmp
<aura:component controller="ContactItemListController" >
    <ltng:require styles="/resource/EquinixBootstrap/equinixbootstrap.css" scripts="/resource/Bootstrapjs/bootstrap.min.js" />    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />   
    <aura:handler event="c:PFAppEvent" action="{!c.doInit}"/>	
    <aura:attribute name="contacts" type="Contact[]"/>    
    
	<aura:iteration items="{!v.contacts}" var="p">
        <c:ContactItem fullName="{!p.Name}" accountName="{!p.Account.Name}" />        
    </aura:iteration> 
</aura:component>
Component to type in the search string-SearchComponent.cmp
<aura:component >
    <ltng:require styles="/resource/EquinixBootstrap/equinixbootstrap.css" scripts="/resource/Bootstrapjs/bootstrap.min.js,/resource/jQuery/jquery-1.11.3.min.js" afterScriptsLoaded="{!c.loadJQuery}"/>    
    <aura:registerEvent name="PFAppEvent" type="c:PFAppEvent"/>
    
    <input type="text" style="width:100%;" class="form-control" placeholder="Name or Username" id="searchBox" />
</aura:component>
Helper method to call Server Side controller and fetch matching contacts-ContactItemListHelper.js
({
 	getContacts: function(component,event) {
      
        var action = component.get("c.getContacts");
        var searchString;
        if(typeof event != 'undefined'){
   			searchString=event.getParam("searchString");
        }else{
            searchString='';
        }
        console.log('Contact List Item:'+searchString);
        action.setParams({
			"searchString": searchString
		});
        action.setCallback(this, function(a) {
            component.set("v.contacts", a.getReturnValue());
        });
        $A.enqueueAction(action);
    }    
})
Listener to Search Component-SearchComponentController.js
({
	loadJQuery: function(component, event, helper) {
        console.log('I am loaded');
        var lastValue = '';
		setInterval(function() {
    		if ($("#searchBox").val() != lastValue) {
	        	lastValue = $("#searchBox").val();
                console.log('New Value:'+lastValue);
		        var appEvent = $A.get("e.c:PFAppEvent");
		        appEvent.setParams({ "searchString" : lastValue });
		        appEvent.fire();                
	    	}
		}, 1500);        
	}

})

 
I am not sure why aura:iteration is displaying blank list of values.I can see that p.id is repeating 5 times but it is showing blank values.Please help Below is my component-ContactItemList.cmp
<aura:component controller="ContactItemListController" >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="contacts" type="Contact[]"/>
	<aura:iteration items="{!v.contacts}" var="p">
        -->{!p.id}
    </aura:iteration>
</aura:component>
Below is my client side controller-ContactItemListController.js
({
	doInit : function(component, event, helper) {
        helper.getContacts(component);
    }
})
Below is my server sider controller-ContactItemListController.apxc
public class ContactItemListController {
	@AuraEnabled
    public static List<Contact> getContacts() {
        List<Contact> cList=[select id from Contact limit 5];
        System.debug('-------->'+cList.size());
        return cList;//[select id, name from contact limit 100];//cList;
    }
}
Below is my helper file-ContactItemListHelper.js
({
 	getContacts: function(component) {
        var action = component.get("c.getContacts");
        action.setCallback(this, function(a) {
            component.set("v.contacts", a.getReturnValue());
            console.log("**"+a.getReturnValue());
        });
        $A.enqueueAction(action);
    }
})






 
I want to integrate Siebel's Oracle database with Salesforce using Lightning Connect.As Siebel cannot expose data using OData protocol, can I use Apex Connector Framework to get this done?Also is there a better way to achieve my goal.Please advise
I would like to know if there is an out of the box way to add attachments from mobile device to any record through Salesforce1 app.If there is no standard way how can we achieve it?
I have configured External Object- Orders as per the instructions in the page -https://developer.salesforce.com/trailhead/lightning_connect/lightning_connect_integrate. But I am not able to see the object in Salesforce1.Please advise
I am dispalying marker for every near by account and below anchor tag should navigate to the respective account upon clicking it.I have used the code in Workbook,but it works neither in Desktop nor in Salesforce1.Please help

try{
            if(sforce.one){
                 accountNavUrl = 'javascript:sforce.one.navigateToSObject(\'' + account.Id + '\')';
             }
} catch(err) {
             console.log(err);
             var dId=account.Id;
             accountNavUrl= '\\' + account.Id;
}
console.log('-->'+accountNavUrl );
var content='<a href src="'+accountNavUrl +'" >'+account.Name+ '</a><br/>'+account.BillingStreet +'<br/>' + account.BillingCity +'<br/>' + account.BillingCountry;

Below is the whole code
<apex:page standardController="Account" extensions="AccountMapExt" sidebar="false" showHeader="false">
  <!-- Begin Default Content REMOVE THIS -->
    <apex:includeScript value="https://maps.googleapis.com/maps/api/js?sensor=false" />  

  <style>
        html, body { height: 100%; }    
        .page-map, .ui-content, #map-canvas { width: 100%; height:100%; padding: 0; }
        #map-canvas { height: min-height: 100%; }
  </style>
  <script>
      var lat;
      var lon;
        function initialize(){ 
            if(navigator.geolocation){
                navigator.geolocation.getCurrentPosition(
                    function(position){
                        lat=position.coords.latitude;
                        lon=position.coords.longitude;
                        Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.AccountMapExt.getNearby}',lat, lon,
                              function(result, event){
                                    if (event.status) {
                                           console.log('->'+lat+' '+lon+' '+result);
                                           createMap(lat, lon, result);
                                    } else if (event.type ==='exception') {
                                            //exception case code
                                    } else {
                                    }
                                    },
                                    {escape: true}
                        );                        
                    }
                );
            } 
          
        }    
        function createMap(lat,lon,accounts){
                console.log('Calling map '+ lat+' '+lon);
                var currentPosition = new google.maps.LatLng(lat,lon);            
                var mapDiv = document.getElementById('map-canvas');
                var map = new google.maps.Map(mapDiv, {
                    center: currentPosition, 
                    zoom: 13,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                });
                var positionMarker = new google.maps.Marker({
                    map: map,
                    position: currentPosition,
                    icon: 'https://maps.google.com/mapfiles/ms/micons/green.png'
                });
                
                for(var i=0; i<accounts.length;i++){
                    account= accounts[i];
                    console.log(accounts[i]);
                    setupMarker();
                }                
                
                function setupMarker(){
                    var accountNavUrl;
                    try{
                        if(sforce.one){
                            accountNavUrl = 'javascript:sforce.one.navigateToSObject(\'' + account.Id + '\')';
                            
                        }
                    } catch(err) {
                        console.log(err);
                        var dId=account.Id;
                        accountNavUrl= '\\' + account.Id;
                    }
                    console.log('-->'+accountNavUrl );
                    var content='<a href src="'+accountNavUrl +'" >'+account.Name+ '</a><br/>'+account.BillingStreet +'<br/>' + account.BillingCity +'<br/>' + account.BillingCountry;
                    //Create the callout that will pop up on the marker
                    var infowindow = new google.maps.InfoWindow({content: content});
                    //Place the marker
                    var marker = new google.maps.Marker({
                        map: map,
                        position: new google.maps.LatLng(account.BillingLatitude,account.BillingLongitude)}
                    );              

                    google.maps.event.addListener(marker, 'click', function(){
                        infowindow.open(map, marker);
                    });                          
                }  
                var mapBoundary = new google.maps.LatLngBounds();
                mapBoundary.extend(currentPosition);                    
         }       
         google.maps.event.addDomListener(window, 'load', initialize);           
  </script>

    <body style="font-family: Arial; border: 0 none;">
        <div id="map-canvas"></div>
    </body>    
  <!-- End Default Content REMOVE THIS -->
</apex:page>

 
I don't see BillingLatitude and BillingLongitude fields exposed on the account page.How to populate these fields and expose it in the account detail page?
We need to know all the opportunities whose owner is not present in the Account team of the accounts associated with the respective opportunities.Suppose we have two opportunities Oppty1 and Oppty2 with owners U1 and U2 respectively.Also Oppty1 and Oppty2 are associated with Account A1 and accounts team contains users U1,U3,U4.So we need opportunity Oppty2 in the result but not Oppty1 as its owner U1 is available in account A1's team.Please let me know how can we get this data
I need to access images from external system using HTTP callouts and display them in Salesforce.
Content-Type →image/png is the format of the reponse Salesforce is receiving
Can we use Blob to store images?
Could anyone throw light on this
I have created a lightning app with a text box and list of contacts under it.As user types in the search string,List contents should be filtered.But I am receiving following error upon typing the search string-rerender threw an error in 'markup://aura:iteration' : Cannot read property 'childNodes' of null.I came across-"http://salesforce.stackexchange.com/questions/71604/lightning-bug-in-lightning-framework-when-using-aurarenderif" but not sure if it is the same reason for this behavior.Could anyone point out the error in my below code.

Component to display list of filtered contacts-ContactItemList.cmp
<aura:component controller="ContactItemListController" >
    <ltng:require styles="/resource/EquinixBootstrap/equinixbootstrap.css" scripts="/resource/Bootstrapjs/bootstrap.min.js" />    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />   
    <aura:handler event="c:PFAppEvent" action="{!c.doInit}"/>	
    <aura:attribute name="contacts" type="Contact[]"/>    
    
	<aura:iteration items="{!v.contacts}" var="p">
        <c:ContactItem fullName="{!p.Name}" accountName="{!p.Account.Name}" />        
    </aura:iteration> 
</aura:component>
Component to type in the search string-SearchComponent.cmp
<aura:component >
    <ltng:require styles="/resource/EquinixBootstrap/equinixbootstrap.css" scripts="/resource/Bootstrapjs/bootstrap.min.js,/resource/jQuery/jquery-1.11.3.min.js" afterScriptsLoaded="{!c.loadJQuery}"/>    
    <aura:registerEvent name="PFAppEvent" type="c:PFAppEvent"/>
    
    <input type="text" style="width:100%;" class="form-control" placeholder="Name or Username" id="searchBox" />
</aura:component>
Helper method to call Server Side controller and fetch matching contacts-ContactItemListHelper.js
({
 	getContacts: function(component,event) {
      
        var action = component.get("c.getContacts");
        var searchString;
        if(typeof event != 'undefined'){
   			searchString=event.getParam("searchString");
        }else{
            searchString='';
        }
        console.log('Contact List Item:'+searchString);
        action.setParams({
			"searchString": searchString
		});
        action.setCallback(this, function(a) {
            component.set("v.contacts", a.getReturnValue());
        });
        $A.enqueueAction(action);
    }    
})
Listener to Search Component-SearchComponentController.js
({
	loadJQuery: function(component, event, helper) {
        console.log('I am loaded');
        var lastValue = '';
		setInterval(function() {
    		if ($("#searchBox").val() != lastValue) {
	        	lastValue = $("#searchBox").val();
                console.log('New Value:'+lastValue);
		        var appEvent = $A.get("e.c:PFAppEvent");
		        appEvent.setParams({ "searchString" : lastValue });
		        appEvent.fire();                
	    	}
		}, 1500);        
	}

})

 
I am not sure why aura:iteration is displaying blank list of values.I can see that p.id is repeating 5 times but it is showing blank values.Please help Below is my component-ContactItemList.cmp
<aura:component controller="ContactItemListController" >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="contacts" type="Contact[]"/>
	<aura:iteration items="{!v.contacts}" var="p">
        -->{!p.id}
    </aura:iteration>
</aura:component>
Below is my client side controller-ContactItemListController.js
({
	doInit : function(component, event, helper) {
        helper.getContacts(component);
    }
})
Below is my server sider controller-ContactItemListController.apxc
public class ContactItemListController {
	@AuraEnabled
    public static List<Contact> getContacts() {
        List<Contact> cList=[select id from Contact limit 5];
        System.debug('-------->'+cList.size());
        return cList;//[select id, name from contact limit 100];//cList;
    }
}
Below is my helper file-ContactItemListHelper.js
({
 	getContacts: function(component) {
        var action = component.get("c.getContacts");
        action.setCallback(this, function(a) {
            component.set("v.contacts", a.getReturnValue());
            console.log("**"+a.getReturnValue());
        });
        $A.enqueueAction(action);
    }
})






 
I want to integrate Siebel's Oracle database with Salesforce using Lightning Connect.As Siebel cannot expose data using OData protocol, can I use Apex Connector Framework to get this done?Also is there a better way to achieve my goal.Please advise
I have configured External Object- Orders as per the instructions in the page -https://developer.salesforce.com/trailhead/lightning_connect/lightning_connect_integrate. But I am not able to see the object in Salesforce1.Please advise
I am dispalying marker for every near by account and below anchor tag should navigate to the respective account upon clicking it.I have used the code in Workbook,but it works neither in Desktop nor in Salesforce1.Please help

try{
            if(sforce.one){
                 accountNavUrl = 'javascript:sforce.one.navigateToSObject(\'' + account.Id + '\')';
             }
} catch(err) {
             console.log(err);
             var dId=account.Id;
             accountNavUrl= '\\' + account.Id;
}
console.log('-->'+accountNavUrl );
var content='<a href src="'+accountNavUrl +'" >'+account.Name+ '</a><br/>'+account.BillingStreet +'<br/>' + account.BillingCity +'<br/>' + account.BillingCountry;

Below is the whole code
<apex:page standardController="Account" extensions="AccountMapExt" sidebar="false" showHeader="false">
  <!-- Begin Default Content REMOVE THIS -->
    <apex:includeScript value="https://maps.googleapis.com/maps/api/js?sensor=false" />  

  <style>
        html, body { height: 100%; }    
        .page-map, .ui-content, #map-canvas { width: 100%; height:100%; padding: 0; }
        #map-canvas { height: min-height: 100%; }
  </style>
  <script>
      var lat;
      var lon;
        function initialize(){ 
            if(navigator.geolocation){
                navigator.geolocation.getCurrentPosition(
                    function(position){
                        lat=position.coords.latitude;
                        lon=position.coords.longitude;
                        Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.AccountMapExt.getNearby}',lat, lon,
                              function(result, event){
                                    if (event.status) {
                                           console.log('->'+lat+' '+lon+' '+result);
                                           createMap(lat, lon, result);
                                    } else if (event.type ==='exception') {
                                            //exception case code
                                    } else {
                                    }
                                    },
                                    {escape: true}
                        );                        
                    }
                );
            } 
          
        }    
        function createMap(lat,lon,accounts){
                console.log('Calling map '+ lat+' '+lon);
                var currentPosition = new google.maps.LatLng(lat,lon);            
                var mapDiv = document.getElementById('map-canvas');
                var map = new google.maps.Map(mapDiv, {
                    center: currentPosition, 
                    zoom: 13,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                });
                var positionMarker = new google.maps.Marker({
                    map: map,
                    position: currentPosition,
                    icon: 'https://maps.google.com/mapfiles/ms/micons/green.png'
                });
                
                for(var i=0; i<accounts.length;i++){
                    account= accounts[i];
                    console.log(accounts[i]);
                    setupMarker();
                }                
                
                function setupMarker(){
                    var accountNavUrl;
                    try{
                        if(sforce.one){
                            accountNavUrl = 'javascript:sforce.one.navigateToSObject(\'' + account.Id + '\')';
                            
                        }
                    } catch(err) {
                        console.log(err);
                        var dId=account.Id;
                        accountNavUrl= '\\' + account.Id;
                    }
                    console.log('-->'+accountNavUrl );
                    var content='<a href src="'+accountNavUrl +'" >'+account.Name+ '</a><br/>'+account.BillingStreet +'<br/>' + account.BillingCity +'<br/>' + account.BillingCountry;
                    //Create the callout that will pop up on the marker
                    var infowindow = new google.maps.InfoWindow({content: content});
                    //Place the marker
                    var marker = new google.maps.Marker({
                        map: map,
                        position: new google.maps.LatLng(account.BillingLatitude,account.BillingLongitude)}
                    );              

                    google.maps.event.addListener(marker, 'click', function(){
                        infowindow.open(map, marker);
                    });                          
                }  
                var mapBoundary = new google.maps.LatLngBounds();
                mapBoundary.extend(currentPosition);                    
         }       
         google.maps.event.addDomListener(window, 'load', initialize);           
  </script>

    <body style="font-family: Arial; border: 0 none;">
        <div id="map-canvas"></div>
    </body>    
  <!-- End Default Content REMOVE THIS -->
</apex:page>

 
Hi,
I have this question how to restrict approval process not to apply based on opp owner(user) role for only specific roles of opp owner.
Owner.UserRole.Name = "User role name" can this formula used to do that
Please let me know. Thanks in advance.
 
Hi All,

I have a requirement where i have a custom object O1 which is having field f1, f2, f3, f4 and I have an email template. When ever a field value is changed i would like to trigger an emailtemplate stating "(f1.OldValue) has been changed to (f1.NewValue)" of that field only. And if there are no change in other fields then the mentioned statement shouldn't appear.
Can anyone tell me the approach.

Regards
 
I messedup with different answers of batch apex help me on this.


Please correct me below if i go wrong any where.!

/* All in case of batch apex*/
* querylocator ---- will fetch 50 million records.
* one soql query -- will fetch 50000 records.
* getquerylocator-- will fetch 10000 records.
===========================================

Please give me clarification for below.

* How many SOQL queries we can write in a single Batc Apex Class.?
* If we can use more than one SOQLs, can we write on different Objects in the same Batch Apex class.?
* Can SOQL query write in all the methods.(start(), execute(), finish()).?

 Give me clarification on this points, i am confused on these things, even shortly or with explanation.

Thanks.
I am trying to develop a report that shows accounts that does not have a specific object data associated. 

My accounts data is populated with building data that we survey and I have objects created with specific fields for each survey we do I need to pull a report on a daily basis to see what buildings that wasn’t surveyed and that was surveyed. I do have a trigger created for duplicates.  Each object has a look up field for account ( Building). Any thought on how I should go about this is much appreciated.
 
 
We have a custom object My_Cases which has a status__c field and the other fields. We want to have a close case button in the detail page of My_case__c, when click it, we want to go to the edit page of My_Case__c with Closed selected in status__c, and only a few fields shown up which some of them are read only. Actually we have created a closed case page layout for it. But I don't know how to call it from my button. Do I have to make my own VF for this function?
I have the opportunity standard object with a custom field called "serial number."  This field is set to look up from  a custom object called "Inventory" where these serial numbers are logged.  The inventory object has all the pertinent info that I need regarding that serial number and also a field called "opportunity." When I create an opportunity, I go the "serial number" field and look up the serial number I need from the inventory object.  This works fine.  What I am trying to do is have the "opportunity" custom field on the inventory object populate the opportunity name where that serial number is assigned automatically.  It seems that I need to use a formula, but I can't get it to work.  Please help!
Please! can someone help me to solve my little problem because I can not do the same,
public class OdtDetailController2 
    {

       
         public list<wrapperclass> Jonintwrapper{get;set;}
         public list<wrapperclass> Odtwrapper{get;set;}
         public Ordre_Travail__c OrdreTravail {get; set;}
        Public Double TotalNombre=0;
        Public Double TotalQuantite=0;
       Public Double Total;
       
         
         public OdtDetailController2(ApexPages.StandardController controller) 
             {
                 OrdreTravail = (Ordre_Travail__c)controller.getRecord();
                 OrdreTravail = [SELECT Id, Date__c, Produit__c, Nombre__c FROM Ordre_Travail__c];
                 list<JointMatProd__c> Jointure = [SELECT id, MatierePremiere__c, Quantite__c FROM JointMatProd__c WHERE produit__c = :OrdreTravail.Produit__c];
                 
                 //list<Ordre_Travail__c> OrdreTravail = [SELECT id, name, Date__c, Produit__c, Nombre__c FROM Ordre_Travail__c WHERE produit__c = :Ordre_Travail__c.Produit__c];
                 //list<JointMatProd__c> Jointure = [SELECT id, MatierePremiere__c, Quantite__c FROM JointMatProd__c WHERE produit__c = :Ordre_Travail__c.Produit__c];
                 Odtwrapper = new list<wrapperclass>();
                 /*for(Ordre_Travail__c Odt: OrdreTravail)
                     {
                        Odtwrapper.add(new wrapperclass(Odt));*/
                         if(OrdreTravail.Nombre__c!=Null){
                             //TotalNombre+=odt.Nombre__c;
                             Odtwrapper.add(new wrapperclass(OrdreTravail));
                             TotalNombre+=OrdreTravail.Nombre__c;

                        } 
                    // }
                     
                 Jonintwrapper = new list<wrapperclass>();
                 for(JointMatProd__c Joint: Jointure)
                     {
                        if(Joint.Quantite__c==Null)
                        Joint.Quantite__c=0; 
                        Jonintwrapper.add(new wrapperclass(Joint,Double.ValueOf(Joint.Quantite__c*TotalNombre)));
                        
                     }
                       

              }
    
              public class wrapperclass
                  {
                       public Ordre_Travail__c ODT{get;set;}
                       public JointMatProd__c JOINT{get;set;}
                       Public Decimal Total{get;set;}
                       
                       public wrapperclass(Ordre_Travail__c OrdreTravail) 
                           {
                                this.ODT = (OrdreTravail);
                           }
                           
                       public wrapperclass(JointMatProd__c Joint,Decimal Total) 
                           {
                                this.JOINT = (Joint);
                                this.Total=Total;
                           }
                  }
    }

here's my problem

"Visualforce ErrorAide sur cette page
System.QueryException: List has more than 1 row for assignment to SObject 
Class.OdtDetailController2.<init>: line 16, column 1"
 
I'm trying to edit multiple records with a list controller extension. I want to use the standard controller {!Save} action, so I only need to use the extension to limit the records I want to show up in my list. The problem is that when I include the list controller extension in my VF page, my edits are not saved. Below is my code for page and extension respectively. Please let me know what I'm doing wrong. If I need to write a custom {!Save} action, please help guide me on how to do that. Thanks for your help!

Visualforce page (called customCommissionEdit):
<apex:page standardController="lda_Commission__c" recordSetVar="TheseCommissions" extensions="extCustomCommissionList">
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages ></apex:pageMessages>
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="quicksave" action="{!quicksave}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!TheseCommissions}" var="comm">
                <apex:column value="{!comm.name}"/>
                <apex:column value="{!comm.Agent_Order__c}"/>
                <apex:column value="{!comm.Agent__c}"/>
                <apex:column value="{!comm.Comm_Dollars__c}"/>
                <apex:column value="{!comm.Comm_Pct__c}"/>
                <apex:column headerValue="Commission Percent">
                    <apex:inputField value="{!comm.Comm_Pct__c}"/>
                </apex:column>
                <apex:column value="{!comm.LAO_Agent__c}"/>
                <apex:column value="{!comm.Role__c}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Controller extension (called extCustomCommissionList):
public with sharing class extCustomCommissionList {

    public extCustomCommissionList(ApexPages.StandardSetController controller) {
    }

     public list<lda_Commission__c> getTheseCommissions() {
            return [SELECT DealID__c, Name, Agent__c, LAO_Agent__c, Agent_Order__c, Comm_Dollars__c, Comm_Pct__c, Fiduciary__c, Role__c FROM lda_Commission__c WHERE DealID__c = :ApexPages.currentPage().getParameters().get('id')]; 
        } 
}

The lda_Commission__c object that I'm trying to edit is a child to another object, so I just want the user to edit the related child lda_Commission__c.

 
I have the below formula that has been working fine, until this month...

DATE( 
year(End_of_Mth__c) 
+ floor((month(End_of_Mth__c) + 4)/12) + if(and(month(End_of_Mth__c)=12,4>=12),-1,0) 

if( mod( month(End_of_Mth__c) + 4 , 12 ) = 0, 12 , mod( month(End_of_Mth__c) + 4 , 12 )) 

min( 
day(End_of_Mth__c), 
case( 
max( mod( month(End_of_Mth__c) + 4 , 12 ) , 1), 
9,30, 
4,30, 
6,30, 
11,30, 
2,28, 
31 


)

when my End of Mth date is 8/31/2014 the date being returned is 12/31/2015 instead of 12/31/2016.  All other months are working fine (before and after 8/31/2014) - I can't figure out why just that date is messing up?

Thank you!!
I'm trying to edit multiple records with a list controller extension. I want to use the standard controller {!Save} action, so I only need to use the extension to limit the records I want to show up in my list. The problem is that when I include the list controller extension in my VF page, my edits are not saved. Below is my code for page and extension respectively. Please let me know what I'm doing wrong. If I need to write a custom {!Save} action, please help guide me on how to do that. Thanks for your help!

Visualforce page (called customCommissionEdit):
<apex:page standardController="lda_Commission__c" recordSetVar="TheseCommissions" extensions="extCustomCommissionList">
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages ></apex:pageMessages>
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="quicksave" action="{!quicksave}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!TheseCommissions}" var="comm">
                <apex:column value="{!comm.name}"/>
                <apex:column value="{!comm.Agent_Order__c}"/>
                <apex:column value="{!comm.Agent__c}"/>
                <apex:column value="{!comm.Comm_Dollars__c}"/>
                <apex:column value="{!comm.Comm_Pct__c}"/>
                <apex:column headerValue="Commission Percent">
                    <apex:inputField value="{!comm.Comm_Pct__c}"/>
                </apex:column>
                <apex:column value="{!comm.LAO_Agent__c}"/>
                <apex:column value="{!comm.Role__c}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Controller extension (called extCustomCommissionList):
public with sharing class extCustomCommissionList {

    public extCustomCommissionList(ApexPages.StandardSetController controller) {
    }

     public list<lda_Commission__c> getTheseCommissions() {
            return [SELECT DealID__c, Name, Agent__c, LAO_Agent__c, Agent_Order__c, Comm_Dollars__c, Comm_Pct__c, Fiduciary__c, Role__c FROM lda_Commission__c WHERE DealID__c = :ApexPages.currentPage().getParameters().get('id')]; 
        } 
}

The lda_Commission__c object that I'm trying to edit is a child to another object, so I just want the user to edit the related child lda_Commission__c.

 
 

 My validation rule says that the status of my object can only go from the "Prospect" status to the "Tentative" or "Lost" status values. How can I create a formula to reflect this?