• Andries.Neyens
  • NEWBIE
  • 155 Points
  • Member since 2013
  • Acuerdo Consultancy


  • Chatter
    Feed
  • 4
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 68
    Replies
Hi I am trying to get that value from a selected list as a variable going to the next VF page.  However, it continues to only give me the default value (2):

VF Page
<apex:page controller="ParameterController">
    <h1>Your latest Membership Status</h1>
  
              <apex:pageBlock >
        <apex:pageBlockSection > 
            <apex:form >       
          <p> How Long to extend your ISN membership
          
  <apex:selectList size="1" value="{!SelectedValue}" label="SelectedValue" id="SelectedValue">
        <b>  <apex:selectOptions value="{!dynamiclist}" /></b>
       <p></p>
             <apex:actionSupport event="onchange" reRender="one"  />
</apex:selectList></p><p></p>
             </apex:form>            
              <form id="browserpost" method="POST" action="Page2">
        <input type="hidden" name="namex" value="{!Contact.Name}"/>
        <input type="hidden" name="Payment" value="{!SelectedValue*203}"/> 
        <button type="submit" >
           Make Payment
        </button> 
        <apex:outputLabel id="one" >      You have selected: {!selectedValue} years.       
   The total cost will be: ${!selectedValue*203}   </apex:outputLabel>
    </form><p></p>    
              </apex:pageBlockSection>
    </apex:pageBlock> 
</apex:page>
Relevant Contoller:
 
// DROP DOWN LIST FOR YEARS TO RENEW 
    public Integer selectedValue {
    get
    {
       if(selectedValue==null)
           selectedValue=2;
 return selectedValue;   }
set;        
}

 public List<SelectOption> getdynamiclist() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('1','1 year'));
        options.add(new SelectOption('2','2 years'));
        options.add(new SelectOption('3','3 years'));
         options.add(new SelectOption('4','4 years'));
        options.add(new SelectOption('5','5 years'));
        return options;
    
    }

Any help would be appreciated!


 
Hi Something strange happening all of a sudden .I am trying to deploy some code to proiduction and i am having 4 ols test classes failuers . All those classes were not modified recently nor any new validations or workfl;ows around them . Could some one help me out please
All my test classes are failing with same erorr System.QueryException: List has no rows for assignment to SObject
@isTest
private class TestUpdateEvents {
    
    private static Account acc{get;set;}
    private static User usr{get;set;}
    private static Profile p{get;set;}
    private static List<Event> EventsList{get;set;}
    
    /* Input: The standard type and Activity Type are passed in as parameters.
    Process: Inserts Event records.
    Output: 20 Events are created.
    Changes: 
*/ 
    static void createTestdata(String Eventtype, String MeetingType)
    {
    acc = new Account (name = 'TestUpdateEvents',phone='111111',BillingCity = 'TestUpdateEventsCity', BillingCountry ='TestUpdateEventsCountry', BillingStreet ='TestUpdateEventsStreet', BillingPostalCode ='updateEvent');
    insert acc;
    
    p = [select id from profile where name='Sales Pro'];
    String[] environment = Userinfo.getUserName().split('@');
        
    usr = new User(FirstName ='TestFirstName',Lastname= 'Testlastname',alias = 'Tst',email= 'TestFirstName1.Testlastname1@mpg.com',
               profileid = TestUpdateEvents.p.Id,username= 'TestFirstName'+ 'Testlastname'+'@'+environment[1],emailencodingkey='UTF-8',
               languagelocalekey='en_US',localesidkey='en_US',timezonesidkey='America/Los_Angeles',
                            Country ='USA',
               CompanyName = 'Manpower',Brand__c = 'ManpowerGroup',Region__c = 'Corporate',Sub_Region__c = 'Corporate');
    insert usr;
    
    EventsList = new List<Event>();
        for(Integer i = 0; i < 20;i++)
        {
        Event e = new Event();
        e.OwnerId = usr.Id;
        e.WhatId = acc.Id;
        e.Type = Eventtype;
        e.Meeting_Type__c = MeetingType;
        e.Subject='Test'+i;
       // t.Status = 'Not Started' ;
      //  t.Priority = 'Normal' ;
        e.ActivityDate = Date.today() + 10;
        e.StartDateTime = Date.today() ;
        e.endDateTime = Date.today();
        EventsList.add(e);
        }
   insert EventsList;
   }
    /* Input: No input variables
    Process: Insert Event records whose Type is null and Activity_Type is 'Call'
    Output: Validate the type field. It should be updated to Call
    Changes: None
*/
    static testMethod void MeetingTypeNOTNullAndTypeIsNull() 
    {
        createTestdata(null,'Call');
        
        List<Event> insertedEvents = [SELECT Id,Meeting_Type__c,Type FROM Event WHERE Id in: EventsList ORDER BY Id];
        for(Integer i = 0;i< insertedEvents.size(); i ++)
        {
        System.assertEquals('Call', insertedEvents[i].Type);
        System.assertEquals('Call', insertedEvents[i].Meeting_Type__c);
        }
    }
     /* Input: No input variables
    Process: Insert Event records whose Type is 'Other' and Activity_Type is 'Call'
    Output: Validate the type field. It should be updated to Call
    Changes: None
*/
    static testMethod void MeetingTypeNOTNullAndTypeNOTNull() 
    {
        createTestdata('Other','Call');
        
        List<Event> insertedEvents = [SELECT Id,Meeting_Type__c,Type FROM Event WHERE Id in: EventsList ORDER BY Id];
        for(Integer i = 0;i< insertedEvents.size(); i ++)
        {
        System.assertEquals('Call', insertedEvents[i].Type);
        System.assertEquals('Call', insertedEvents[i].Meeting_Type__c);
        }
    }
   /* Input: No input variables
    Process: Insert Event records whose Type is 'Sent E-mail' and Activity_Type is 'Call'
    Output: Validate the type and Activity_Type fields. Activity_Type should be updated to Sent E-mail.
    Changes: None
*/  
    static testMethod void MeetingTypeNOTNullAndTypeIsSentEmail() 
    {
        createTestdata('Sent E-mail','Call');
        
        List<Event> insertedEvents = [SELECT Id,Meeting_Type__c,Type FROM Event WHERE Id in: EventsList ORDER BY Id];
        for(Integer i = 0;i< insertedEvents.size(); i ++)
        {
        System.assertEquals('Sent E-mail', insertedEvents[i].Type);
        System.assertEquals('Sent E-mail', insertedEvents[i].Meeting_Type__c);
        }
    }
   
    /* Input: No input variables
    Process: Insert Event records whose Type is 'Sent E-mail' and Activity_Type is 'null'
    Output: Validate the Activity_Type field. It should be updated to Sent E-mail
    Changes: None
*/ 
    static testMethod void MeetingTypeNullAndTypeIsSentEmail() 
    {
        createTestdata('Sent E-mail',null);
        
        List<Event> insertedEvents = [SELECT Id,Meeting_Type__c,Type FROM Event WHERE Id in: EventsList ORDER BY Id];
        for(Integer i = 0;i< insertedEvents.size(); i ++)
        {
        System.assertEquals('Sent E-mail', insertedEvents[i].Type);
        System.assertEquals('Sent E-mail', insertedEvents[i].Meeting_Type__c);
        }
    }
 
  /* Input: No input variables
    Process: Insert Event records whose Type is 'Call' and Activity_Type is 'null'
    Output: Validate the type and Activity_Type fields. They should be updated to Call
    Changes: None
*/   
    static testMethod void MeetingTypeNullAndTypeNOTNull() 
    {
        createTestdata('Call',null);
        
        List<Event> insertedEvents = [SELECT Id,Meeting_Type__c,Type FROM Event WHERE Id in: EventsList ORDER BY Id];
        for(Integer i = 0;i< insertedEvents.size(); i ++)
        {
        System.assertEquals('Call', insertedEvents[i].Type);
        System.assertEquals('Call', insertedEvents[i].Meeting_Type__c);
        }
    }
    
    /* Input: No input variables
    Process: Insert Event records whose Type is 'null' and Activity_Type is 'Call'.
    Then update the activity_Type from 'Call' to 'RFI'
    Output: Validate the type and Activity_Type fields. They should be updated to RFI.
    Changes: None
*/ 
    static testMethod void modifyOnlyMeetingType() 
    {
        createTestdata(null,'Call');
        List<Event> updateEvents = new List<Event>();
        
        updateEvents = [SELECT Id,Meeting_Type__c,Type FROM Event WHERE Id in: EventsList ORDER BY Id];
        for(Integer i = 0;i< updateEvents.size(); i ++)
        {
        updateEvents[i].Meeting_Type__c = 'RFI';
        }
        update updateEvents;
        
        List<Event> updatedEvents = [SELECT Id,Meeting_Type__c,Type FROM Event WHERE Id in: updateEvents ORDER BY Id];
        
        for(Integer i = 0;i< updatedEvents.size(); i ++)
        {
        System.assertEquals('RFI', updatedEvents[i].Type);
        System.assertEquals('RFI', updatedEvents[i].Meeting_Type__c);
        }
    }
    /* Input: No input variables
    Process: Insert Event records whose Type is 'null' and Activity_Type is 'Call'.
    Then update the activity_Type to 'Sent E-mail' and Type to 'Other'
    Output: Validate the type and Activity_Type fields. They should be updated to Sent E-mail.
    Changes: None
*/   
    static testMethod void modifyMeetingTypeAndEventType() 
    {
        createTestdata(null,'Call');
        List<Event> updateEvents = new List<Event>();
        
        updateEvents = [SELECT Id,Meeting_Type__c,Type FROM Event WHERE Id in: EventsList ORDER BY Id];
        for(Integer i = 0;i< updateEvents.size(); i ++)
        {
        updateEvents[i].Meeting_Type__c = 'Sent E-mail';
        updateEvents[i].Type = 'Other';
        }
        update updateEvents;
        
        List<Event> updatedEvents = [SELECT Id,Meeting_Type__c,Type FROM Event WHERE Id in: updateEvents ORDER BY Id];
        
        for(Integer i = 0;i< updatedEvents.size(); i ++)
        {
        System.assertEquals('Sent E-mail', updatedEvents[i].Type);
        System.assertEquals('Sent E-mail', updatedEvents[i].Meeting_Type__c);
        }
    }
    /* Input: No input variables
    Process: Insert Event records whose Type is 'null' and Activity_Type is 'Call'.
    Then update the standard Type to 'Sent E-mail' 
    Output: Validate the type and Activity_Type fields. They should be updated to Sent E-mail.
    Changes: None
*/  
    static testMethod void modifyOnlyEventType() 
    {
        createTestdata(null,'Call');
        List<Event> updateEvents = new List<Event>();
        
        updateEvents = [SELECT Id,Meeting_Type__c,Type FROM Event WHERE Id in: EventsList ORDER BY Id];
        for(Integer i = 0;i< updateEvents.size(); i ++)
        updateEvents[i].Type = 'Sent E-mail';
       
        update updateEvents;
        
        List<Event> updatedEvents = [SELECT Id,Meeting_Type__c,Type FROM Event WHERE Id in: updateEvents ORDER BY Id];
        
        for(Integer i = 0;i< updatedEvents.size(); i ++)
        {
        System.assertEquals('Sent E-mail', updatedEvents[i].Type);
        System.assertEquals('Sent E-mail', updatedEvents[i].Meeting_Type__c);
        }
    }
   }

Same code in prod and sandbox since 2012 and not modifed since then.Here are the errors i get in production

System.QueryException: List has no rows for assignment to SObject  (Same error For all the below methods)

Class.TestUpdateEvents.createTestdata: line 27, column 1
Class.TestUpdateEvents.MeetingTypeNOTNullAndTypeNOTNull: line 79, column 1

Class.TestUpdateEvents.createTestdata: line 27, column 1
Class.TestUpdateEvents.MeetingTypeNullAndTypeIsSentEmail: line 112, column 1

Class.TestUpdateEvents.createTestdata: line 27, column 1
Class.TestUpdateEvents.MeetingTypeNullAndTypeNOTNull: line 129, column 1

Class.TestUpdateEvents.createTestdata: line 27, column 1
Class.TestUpdateEvents.modifyMeetingTypeAndEventType: line 173, column 1

Class.TestUpdateEvents.createTestdata: line 27, column 1
Class.TestUpdateEvents.modifyOnlyEventType: line 200, column 1

Class.TestUpdateEvents.createTestdata: line 27, column 1
Class.TestUpdateEvents.modifyOnlyMeetingType: line 147, column 1

Class.TestUpdateEvents.createTestdata: line 27, column 1
Class.TestUpdateEvents.MeetingTypeNOTNullAndTypeIsNull: line 63, column 1

Class.TestUpdateEvents.createTestdata: line 27, column 1
Class.TestUpdateEvents.MeetingTypeNOTNullAndTypeIsSentEmail: line 95, column 1

 

I am trying to create a test class for a new trigger and it involves a lookup to a user record.  In my test class, do i have to create a new user entry, or is there a way to to reference any existing users in the org for the test? 

I'm trying to launch a custom quick action from within a Lightning Component.
According the example given, it should work:

https://developer.salesforce.com/docs/atlas.en-us.case_feed_dev.meta/case_feed_dev/quickaction_api_getCustomAction.htm

And it all does work, if I add the highlight panel on the page that include the Quick action.
If you remove it from the page, the api returns:
 
{"targetName":"Contact","actionName":"Contact.Call","success":false,"parentContext":null}
Is there a way to call them, without having them on the lightning page?

 
oAuth Login is working just fine, the only problem we are facing is to have the opportunity to change the language of the interface of the login screen.
Is this possible?

We are using this in a Community with a cutom login page.
Adding querystring params to the url (/services/oauth2/authorize) are of course wiped out...
So when landing on the custom login screen (after the redirect), we have no clue in what language the user want this.
Hi all,

we are using the 'et4ae5.triggerUtility.automate' function from the Managed Package Marketing Cloud 5.41.
But it contains a encoding bug in the outgoing json.
If a custom field contains a " (quote) the json that is send out to the ET api is invalid.
Does anyone know when this will be fixed or are there any custom fixes ?

Andries
 
Simple problem, but cannot find a solution for it.
I removed the system administrator profile from the members from a community.
In my opinion not needed to manage a community.
Too bad the documents states differently, so I cannot change edit the community anymore.

Is there a way to correct this???
Hi all,

we are trying to use AngularJS as a community site.
Problem is that the first page is accessible as a guest user.
All remote action calls are public.
At a certain point, the calls must be made protected (via profile and apex class security)

Here we want to use some sort of login via remote actions using Site.Login
But helas, this is not working.
Session id's returned are still for guest users (but login was successful, can be seen in the login history)
Only way to let this work is use the standard login page that somehow sets session id's via cookies?
no idea how to mimic this ??

andries
When setting up SSO with ADFS 2.0 you will encounter the following error on AD if you are importing the metadata for different Orgs like Production, UAT, Test:

MSIS7613: The signing certificate of the relying party trust is not unique across all relying party trusts in AD FS 2.0 configuration

This is a well known 'problem' of MS AD

http://blog.msresource.net/2013/03/05/msis7613-the-signing-certificate-of-the-relying-party-trust-is-not-unique-across-all-relying-party-trusts-in-ad-fs-2-0-configuration/


Is there a way to create unique certificates for every Salesforce Org ?
Hi all,

I'm trying to remove the automatic linking of an PersonAccount to a Case with triggers, but no success:

Insert Before Case trigger: The link is not yet put into the account lookup field.
Insert After Case trigger: the automatic linking is available, so I try to remove it (with a future call ofcourse)

And what happens, it is linked again.

Same is happening if I do this via the Salesforce gui, edit the case, remove the account lookup and save: link is put back again

Hi all,

I'm trying to customize a visual force page for the Service Console and want to add Custom Service Components to the left and right of the Page.
I looked into the Service toolkit, but cannot find it. Is it possible?

Also a bit dazzled that an Action returning a correct PageReference works in the sales environment but not in the Service Console. Why is this not transparant ?


Many thanks
Seems that the outputlink has a strange behavior in Salesforce1,

given the following scenario:

<apex:page controller="Salesforce1Bug" showChat="false" applyHtmlTag="false" applyBodyTag="false" sidebar="false" showHeader="false" title="Is this by design?" docType="html-5.0" standardStylesheets="false" >
    <html>                
        <head>
            <title>Is this by design?</title>
        </head>
        <body>
       
         Parameter: <apex:outputtext value="{!Param}"/>
         <br/>
            <apex:outputLink value="/apex/Salesforce1Bug?parameter=something%20something">This is a working link
               
            </apex:outputLink>
        <br/>
            <apex:outputLink value="/apex/Salesforce1Bug">This is not a working link
                <apex:param name="parameter" value="the dark side" />
            </apex:outputLink>
            <br/>
        </body>
    </html>
</apex:page>


and

public with sharing class Salesforce1Bug {
   public String getParam()
   {
     return ApexPages.currentPage().getParameters().get('parameter');
   }
}


This works perfectly in the browser, but if you access this page in Salesforce1 you will see that the second link will not work and the encoding is a bit dodgy?

Anyone an idea what the difference is?

I you try out the following simple example:

 

<apex:page controller="Bug" showChat="false" sidebar="false" showHeader="false" docType="html-5.0" standardStylesheets="false">

	<apex:form >
		<apex:actionFunction name="fetchList" reRender="pnlResult" action="{!FetchList}"  />
	
	
		<apex:outputPanel id="pnlResult" >
			<apex:repeat value="{!JustAList}" var="word">
				<apex:commandLink >             	
		            	<h1>Header</h1>
		            	<p>{!word}</p>
		        </apex:commandLink>
			</apex:repeat>	
		</apex:outputPanel>
	</apex:form>


	  <script>
	  		window.setTimeout(fetchList(), 5000);
	  </script>

</apex:page>

 

public with sharing class Bug {
	public List<String> JustAList{ get; set;}
	
	 public PageReference FetchList() {
	 	if (this.JustAList == null)
	 		this.JustAList = new List<String>{'Is','this','a','bug','?'};
	 	
	 	return null;
	 }
}

 

And view the rendered source, something weird is going on:

 

<span xmlns="http://www.w3.org/1999/xhtml" id="j_id0:j_id1:pnlResult"><script type="text/javascript" language="Javascript">//<![CDATA[
function dpf(f) {var adp = f.adp;if (adp != null) {for (var i = 0;i < adp.length;i++) {adp[i].parentNode.removeChild(adp[i]);}}};function apf(f, pvp) {var adp = new Array();f.adp = adp;var ps = pvp.split(',');for (var i = 0,ii = 0;i < ps.length;i++,ii++) {var p = document.createElement("input");p.type = "hidden";p.name = ps[i];p.value = ps[i + 1];f.appendChild(p);adp[ii] = p;i += 1;}};function jsfcljs(f, pvp, t) {apf(f, pvp);var ft = f.target;if (t) {f.target = t;}f.submit();f.target = ft;dpf(f);};
//]]>
</script> <a href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('j_id0:j_id1'),'j_id0:j_id1:j_id3:0:j_id4,j_id0:j_id1:j_id3:0:j_id4','');}return false"></a><h1><a href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('j_id0:j_id1'),'j_id0:j_id1:j_id3:0:j_id4,j_id0:j_id1:j_id3:0:j_id4','');}return false">Header</a></h1> <p>Is</p> <a href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('j_id0:j_id1'),'j_id0:j_id1:j_id3:1:j_id4,j_id0:j_id1:j_id3:1:j_id4','');}return false"></a><h1><a href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('j_id0:j_id1'),'j_id0:j_id1:j_id3:1:j_id4,j_id0:j_id1:j_id3:1:j_id4','');}return false">Header</a></h1> <p>this</p> <a href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('j_id0:j_id1'),'j_id0:j_id1:j_id3:2:j_id4,j_id0:j_id1:j_id3:2:j_id4','');}return false"></a><h1><a href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('j_id0:j_id1'),'j_id0:j_id1:j_id3:2:j_id4,j_id0:j_id1:j_id3:2:j_id4','');}return false">Header</a></h1> <p>a</p> <a href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('j_id0:j_id1'),'j_id0:j_id1:j_id3:3:j_id4,j_id0:j_id1:j_id3:3:j_id4','');}return false"></a><h1><a href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('j_id0:j_id1'),'j_id0:j_id1:j_id3:3:j_id4,j_id0:j_id1:j_id3:3:j_id4','');}return false">Header</a></h1> <p>bug</p> <a href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('j_id0:j_id1'),'j_id0:j_id1:j_id3:4:j_id4,j_id0:j_id1:j_id3:4:j_id4','');}return false"></a><h1><a href="#" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('j_id0:j_id1'),'j_id0:j_id1:j_id3:4:j_id4,j_id0:j_id1:j_id3:4:j_id4','');}return false">Header</a></h1> <p>?</p></span>

 

It seems that the A tag is rendered twice, and the P tag is not included...

 

so the structure should be:

 

<a>
   <h1></h1>
   <p></p>
</a>

 

but it renders it as:

 

<a></a>
<h1><a></a></h1>
<p><p>

 

Weird ?? bug ?? by desing?

Something as simple as:

 

[SELECT Id FROM Profile WHERE Name='System Administrator' LIMIT 1]

 

can fail if the language locale of the current running user is different than English.

 

Is there a clean workaround?

I,m trying to write some unit tests for a community user but it seems that I am doing something wrong with the security:

 

In my controller I do the following (I compressed the code a bit ;-) :

 

 

public class MyController


...


Id aId =[SELECT Id, Contact.AccountId FROM User WHERE Id=: UserInfo.getUserId() LIMIT 1].Contact.AccountId;

List<Opportunity> oppties = [SELECT ... FROM Opportunity WHERE AccountID =: aID];


... 

 

 

Now you are all thinking; hang on, a community user has no access to the opportunities!

That is correct, hence the class definition without the 'with sharing' and afterwards I put the opportunities in a wrapper..

 

Anyhow, this is working perfectly with a correct community user, created via a contact of an account ()

 

 

Now the test:

 

// add an account

// add a contact to that account

// create a user connected to that contact, with the profile of the community user

// Create 10 opportunities on that account

 

System.runAs(theUser) {
	System.assert([select UserType from user where id = :UserInfo.getUserId()].UserType == 'CSPLitePortal');
        	
        	Test.startTest();    	
        	MyController controller = new MyController();
    	Test.stopTest();
    		
    	//We should have 10 wrapped opportunities
    	System.AssertEquals(10, controller.Opportunities.size());
}

 

The first assert works, assuming the user is correctly made?

no errors, but the second assert fails that it does not find any opportunies.

Ofcourse the second assert works if i run it as an admin.

 

Is there something I'm missing ???

 

 

Hi all,

we are using the 'et4ae5.triggerUtility.automate' function from the Managed Package Marketing Cloud 5.41.
But it contains a encoding bug in the outgoing json.
If a custom field contains a " (quote) the json that is send out to the ET api is invalid.
Does anyone know when this will be fixed or are there any custom fixes ?

Andries
 
I'm trying to launch a custom quick action from within a Lightning Component.
According the example given, it should work:

https://developer.salesforce.com/docs/atlas.en-us.case_feed_dev.meta/case_feed_dev/quickaction_api_getCustomAction.htm

And it all does work, if I add the highlight panel on the page that include the Quick action.
If you remove it from the page, the api returns:
 
{"targetName":"Contact","actionName":"Contact.Call","success":false,"parentContext":null}
Is there a way to call them, without having them on the lightning page?

 
Hi All,
 I have one master (obj A) and 3 child object (ObjB,ObjC,ObjD) in look up relationship. Each child have Amt field and Mast have Final_Amount(ie sum of Amt all childs record) . I want whenever new record is created in any of child object sum of Amt field is get added\updated in master field.
Example
ObjB - 3 records Sum (Amt) = 40
ObjC - 2 records Sum (Amt) = 45
ObjD - 4 records Sum (Amt) = 50

So value in ObjA Final_Amounts should be  (40+45+50)= 135
Now one more entry is added in ObjD with Value 10 Then Final_Amounts  should be 145
First thought for this is Trigger on each 3 child object. But implementation\logic will be same for 3 trigger.(Want to avoid code same code repetition)
Is there any way I can achieve this with Trigger ?

Also please suggest some other way is there to achieve this.
Hello,

I am wondering if something like this is possible using just workflows. An example of what I am trying to do would be if someone creates a new opportunity, then a window pops up for them to fill out name, then they click next and a window pops up for them to fill in company/title, etc.

Is this doable?

Thanks,
Frank
Long story short, I'm trying to write a single app for multiple salesforce because a parent company acquired other companies that are  staying in their separate instances of salesforce. I'm trying to create a single global application, but I'm getting Apex errors with my force-app classes because some properties of some objects exist in some instances but not others. My immediate challenge is when I try to write my Apex code, on SDFX force / push (to the scratch org) the compiler checks and throws an error when it sees my Apex classes attempt to access (potentially) non-existent custom properties of the Opportunity object. 

e.g. salesforce instance 1 has custom properties on the Opportunity A, B, C and instance 2 has custom properties X, Y, Z, 
My code will detect which instance of salesforce I'm using (either with custom settings or metadata -- I haven't worked that out yet), then it would only execute settings where the properties do in fact exist. In theory, the code should work fine because it will detect the right instance of salesforce and only execute the right code (the code differences are also small -- so I only want to include that in my current project).

Anyway, my problem is I am writing one application artifact / pacakge, and I don't want to replicate thousands of lines of code just because each salesforce instance requires slightly different code -- I also can't share properties between salesforce instances because each salesforce instance has a different defition of opportunity custom properties, and each instance also typically uses 500+ properties.  

What kind of solutions are viable here?
1-many force-apps? (terrible) do i have to write a separate app (and massively duplicate my code) for each salesforce instance?
2-conditional imports? (decent if possible) could i do conditional imports in my apex classes & put the extra support code in separate artifacts?
3-object inheritance? (would be nice) can I write a core artifact and extend it with my other artifacts -- and use some object inheritance across artifacts?
4-what other options do I have -- are there other possibilites? 
Hi I am trying to get that value from a selected list as a variable going to the next VF page.  However, it continues to only give me the default value (2):

VF Page
<apex:page controller="ParameterController">
    <h1>Your latest Membership Status</h1>
  
              <apex:pageBlock >
        <apex:pageBlockSection > 
            <apex:form >       
          <p> How Long to extend your ISN membership
          
  <apex:selectList size="1" value="{!SelectedValue}" label="SelectedValue" id="SelectedValue">
        <b>  <apex:selectOptions value="{!dynamiclist}" /></b>
       <p></p>
             <apex:actionSupport event="onchange" reRender="one"  />
</apex:selectList></p><p></p>
             </apex:form>            
              <form id="browserpost" method="POST" action="Page2">
        <input type="hidden" name="namex" value="{!Contact.Name}"/>
        <input type="hidden" name="Payment" value="{!SelectedValue*203}"/> 
        <button type="submit" >
           Make Payment
        </button> 
        <apex:outputLabel id="one" >      You have selected: {!selectedValue} years.       
   The total cost will be: ${!selectedValue*203}   </apex:outputLabel>
    </form><p></p>    
              </apex:pageBlockSection>
    </apex:pageBlock> 
</apex:page>
Relevant Contoller:
 
// DROP DOWN LIST FOR YEARS TO RENEW 
    public Integer selectedValue {
    get
    {
       if(selectedValue==null)
           selectedValue=2;
 return selectedValue;   }
set;        
}

 public List<SelectOption> getdynamiclist() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('1','1 year'));
        options.add(new SelectOption('2','2 years'));
        options.add(new SelectOption('3','3 years'));
         options.add(new SelectOption('4','4 years'));
        options.add(new SelectOption('5','5 years'));
        return options;
    
    }

Any help would be appreciated!


 

Hi guys,

Why it keep on showing me this message (Map key error), instance I want to display the Error Message that I type myself. And, when i view in Log of Developer Console, it got show that I got hit my Error Message but why it still cant show in Visualforce Page???Map Key Error

 

Hi all,
I want to show the duplicate email validation error message in first Custom vfpage while redirecting to second vfpage. In Save method  I have written try catche method which is calling in the second page. But In the first page i want to show the duplicate email Id validation error message.

Can anyone help me over here.

Thanks in advance.
Regrads,
mac.
I've been using Web-to-case for clients for a few months now and have never had an issue.  Today I came across an issue where the field "Estimated Start Date" show up blank, even though I made the field required in the online form.  This appears to be for 1 client only and 1 contact, as other clients and contacts from that client are coming in with the Estimated Start Date showing.  Any ideas?
Hi,
When I checked below code in my dev org. It was almost cover 97% code covrage but when I applied same code in my sandbox it was showing only 10% of code covrage. Strange!
Please fing bellow batch class and test class:
global class SendEmailToDueDateTask implements Database.Batchable<sObject>  {
    map<string,list<task>> userEmailTasklistmap = new map<string,list<task>>();
    
    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator([SELECT ID,createddate,what.id,Owner.Email,OwnerId,owner.name,Status,ActivityDate,Subject from Task WHERE Status != 'Completed' and owner.isactive = true and owner.profile.id = '00eD0000001Qs3R']);
    }
    
    global void execute(Database.BatchableContext BC, List<Task> scope){
        for(Task Tsk : scope){
            if(!userEmailTasklistmap.Containskey(tsk.owner.email)){
                userEmailTasklistmap.put(tsk.owner.email, new list<task>());
            }
            userEmailTasklistmap.get(tsk.owner.email).add(tsk);
            
          }  
        List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
    
            for(string email : userEmailTasklistmap.keyset()){
                
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                list<string> toAddresses = new list<string>();
                toAddresses.add(email);
                mail.setToAddresses(toAddresses);
                mail.setSubject('Details of tasks due for today');                
                String username = userEmailTasklistmap.get(email)[0].owner.name;
                String htmlBody = '';
                
                htmlBody = '<table width="100%" border="0" cellspacing="0" cellpadding="8" align="center" bgcolor="#F7F7F7">'+
                            +'<tr>'+
                              +'<td style="font-size: 14px; font-weight: normal; font-family:Calibri;line-height: 18px; color: #333;"><br />'+
                                   +'<br />'+
                                    +'Dear '+username+',</td>'+
                            +'</tr>'+
                            +'<tr>'+
                                +'<td style="font-size: 14px; font-weight: normal; font-family:Calibri; line-height: 18px; color: #333;">Following tasks are pending. Please update the status.</td>'+
                            +'</tr>'+
                        +'</table>';
 
                htmlBody +=  '<table border="1" style="border-collapse: collapse"><tr><th>Related To</th><th>Subject</th><th>Created Date</th><th> Due Date</th></tr>';
                for(task tsk : userEmailTasklistmap.get(email)){
                    
                    String duedate = '';
                    if (tsk.ActivityDate != null)
                        duedate = tsk.ActivityDate.format();                    
                    else
                        duedate = '';
                    String Subject = tsk.subject;
                    datetime dt = tsk.createddate;
                    string createddate = dt.format('M/d/yyyy');
                    //string what = https://ap2.salesforce.com/tsk.what.id;
                    string View = URL.getSalesforceBaseUrl().toExternalForm()+'/'+ tsk.id;
                    string Clickhere = View;  
                    htmlBody += '<tr><td>' + Clickhere + '</td><td>' + Subject + '</td><td>' + createddate + '</td><td>' + duedate + '</td></tr>';                    
                }
                 htmlBody += '</table><br>';
                 mail.sethtmlBody(htmlBody);
                 mails.add(mail);                    
            }
             if(mails.size()>0)
             Messaging.sendEmail(mails);
    }
    global void finish(Database.BatchableContext BC){        
    }
}

Test Class:
@isTest 

public class SendEmailToDueDateTaskTest { 

static testMethod void testMethod1(){ 

        Profile pro = [SELECT Id FROM Profile WHERE Name='Standard User'];  
        User usr = new User(Alias = 'standt', Email='standarduser@tt.com',  
        EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',  
        LocaleSidKey='en_US', ProfileId = pro.Id,  
        TimeZoneSidKey='America/Los_Angeles', UserName='standarduser@tt.com'); 

        System.runAs(usr) { 
            Account acc = new Account(); 
                acc.Name = 'Test Account'; 
                insert acc; 
                acc=[SELECT id,Name FROM account WHERE id=:acc.Id]; 
                System.assertEquals(acc.Name,'Test Account'); 
            Task tsk = new Task(); 
                tsk.whatId = acc.Id;  
                tsk.Subject = 'Testing'; 
                tsk.Status = 'In Progress'; 
                tsk.Priority = 'Normal'; 
                tsk.ActivityDate = System.today(); 
                insert tsk ; 
                tsk=[SELECT id,Status FROM Task WHERE id=:tsk.Id]; 
                System.assertEquals(tsk.Status ,'In Progress'); 
            } 
            Test.StartTest(); 
                Database.executeBatch (new SendEmailToDueDateTask (),200); 
            Test.StopTest(); 
    } 
 }

Please help. Where I am wrong.
Hi All, 

We had this following error : 502 (Bad Gateway) when we tried to call a WS (soap) from community.
There is no issue if we test it in admin

here the code : 


sforce.connection.remoteFunction({
              url : "https://v10-creditor.cs81.force.com/creditor/services/Soap/class/WebServiceTest",//"https://" + window.location.host + "/services/Soap/class/WebServiceTest",//"https://maps.googleapis.com/maps/api/geocode/json?address=Kensington",
            //mimeType: "text/xml",
            cache : false,
            async: false,
              requestHeaders: {"Authorization":"Bearer " + __sfdcSessionId, 
              "Content-Type":"text/xml",
                        "SOAPAction": "Hello"
                    },
              requestData: envelope.join(''),
              method: "POST",
              onSuccess : function(response) {
                  // sforce.debug.log(response);
                  console.log('response: ');
                  console.log(response);
                  var obj = JSON.stringify(xmlDoc);
                  console.log('stringify: ');
                  console.log(obj);
                   var jObj = JSON.parse(obj);
                  //alert("onSuccess: \n\n" + jObj);
                  console.log('JSON: ');
                   console.log(jObj);

                  return returnObject;
              },
              onFailure : function(response) {
                  console.log(response);
                  var parser = new DOMParser();
                  var xmlDoc = parser.parseFromString(response,"text/xml");
                  //alert("onFailure end:" + xmlDoc);
                  return returnObject;
              }
            });
            // Step 3: Get Response from GED WS - Khanh
            return returnObject;
        }

 
Hi ,

Could you please help me on below error,

System.SObjectException: Field is not writeable: User.ProfileId

thanks in advance.
venu
Hi all,

we are trying to use AngularJS as a community site.
Problem is that the first page is accessible as a guest user.
All remote action calls are public.
At a certain point, the calls must be made protected (via profile and apex class security)

Here we want to use some sort of login via remote actions using Site.Login
But helas, this is not working.
Session id's returned are still for guest users (but login was successful, can be seen in the login history)
Only way to let this work is use the standard login page that somehow sets session id's via cookies?
no idea how to mimic this ??

andries