• Prem_Pal
  • NEWBIE
  • 139 Points
  • Member since 2014
  • Senior Salesforce developer
  • REI Systems

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 46
    Replies
it dosent work issue is with id

<apex:page controller="showpick">
<apex:sectionHeader title="this is section header title"/>
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="save" action="{!save}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="this is page block section title" columns="2">
<apex:selectList size="1" value="{!selectedcountry}">
<apex:selectOptions value="{!country}"/>
<apex:actionSupport event="onchange" rerender="save"/>

</apex:selectList>

</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

class:
public class showpick
{
     public string selectedcountry{get;set;}
     public showpick()
     {}
    
     public list<selectoption> getcountry()
     {
       list<selectoption> options = new list<selectoption>();
      options.add(new selectoption('-','none'));
      options.add(new selectoption('abc','a'));
      options.add(new selectoption('xyz','x'));
     
      return options;
    
     }
     public pagereference save()
     {
      pagereference pref = new pagereference('/apex/show?id='+id);
      pref.setredirect(true);
      return pref;
      }
}
Error Error: showpick Compile Error: Variable does not exist: id at line 19 column 63

other vf page
<apex:page standardController="account">
<apex:pageBlock>
<apex:pageBlockSection>
<apex:outputText label="you selected" value="{!selectedcountry}">
</apex:outputText>
</apex:pageBlockSection>
</apex:pageBlock>
 
</apex:page>
Hi Everybody,
    Can anyone tell me what is community and how to create custom community??


Thanks in advance
Karthick
If I only know instance URL and the record id, may I combinate a like address to open the record editing page?

record editting page

When I open a editting page, the like looks like: https://na3.salesforce.com/0015000000szXbM/e?retURL=%2F0015000000szXbM. Besides the instance URL and record id, it still has a query param: retURL=%2F0015000000szXbM. What this query param?How can I get it?

Thanks
Charley
I was able to develope an API which can send emails from saleforce through mailgun. emails are successfully being send. but attachments are not working.. we despirately in need of ability to send attachements. Please find my code .. this perticular code is not showing any error its working but attachments are not getting send only the email is send. 

@RemoteAction  @future (callout=true)
    public static void sendEmailResponse(String notId, String response, Boolean hasAttachment, string csvFileId, String responseSubject, String toEmail, String toCCEmail){
        System.debug('********** inside send email******');
        if(toEmail == '' || response == ''){ 
            return;
        }
        String status = '';
        
        if(toEmail != '' && response != ''){ 
            string sURL =   'https://api.mailgun.net/v3/sandboxedaf562949124727b836108ded5d10ed.mailgun.org/messages'; 
            string sBody = '';
            String strSubject = responseSubject;
            string sReturn = '';
            String attachmentBody = '';
            String bodyPayload='';
            String separationString = 'A_RANDOM_STRING';
            HttpRequest req = new HttpRequest();
            HttpResponse res = new HttpResponse();
            Http http = new Http();
            
            String authUserName = 'postmaster@sandboxedafxxxxxxxxxed.mailgun.org'; 
            String authUserPassword = '1fxxxxxxxxxxxxxxxxxxxxxx';
            String filePath; 
            if(hasAttachment){
                Attachment csvFile = [select id, body, Name from Attachment where id=:csvFileId];
                String header = '--' + separationString + 
                 + 'Content-Disposition: form-data; name="file"; filename="'+csvFile.name
                 +'"\nContent-Type: application/octet-stream\n\n';
                 attachmentBody =  EncodingUtil.base64Encode(csvFile.Body);
                 String footer = '--' + separationString + '--';
                  bodyPayload= header+attachmentBody+footer;
                 
                // filePath = 'https://c.cs91.content.force.com/servlet/servlet.FileDownload?file='+csvFile.id;
                filePath = 'http://che.org.il/wp-content/uploads/2016/12/pdf-sample.pdf'; // a sample public file for testing purpose

            }
            
            String fromemail = 'NoReply<zahir.basith@virtual1.com>'; 
            String toSetCCEmail ='';
            if(responseSubject != '' || responseSubject != Null){
                responseSubject = EncodingUtil.urlEncode( responseSubject, 'UTF-8');
            }
            String subject = responseSubject;
            String message  = response.unescapeHtml4();
            message = EncodingUtil.urlEncode( message, 'UTF-8');
            
            Blob headerValue = Blob.valueOf('api:key-xxxxxxxxxxxxxxxxxxxxxxxx');
            String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
            req.setHeader('Authorization', authorizationHeader);
            req.setHeader('Content-Type','multipart/form-data; boundary=' + separationString);
            req.setHeader('Host', 'sandboxedaf562949124727b836108ded5d10ed.mailgun.org');
            
            if(toCCEmail != ''){
                toSetCCEmail= '&cc='+toCCEmail;
            } 
            string mailBody;
            if(hasAttachment){
                mailBody = sURL+'?from='+fromemail+'&to='+toEmail+'&attachment='+filePath+'&subject='+subject+'&html='+message;
                req.setBody('{ "from": "'+fromemail+'",  "to": "'+toEmail+'", "cc":"'+toCCEmail+'", "attachments": "'+filePath+'", "subject": "'+subject+'",  "html": "'+message+'"}');
            }else{
                mailBody = sURL+'?from='+fromemail+'&to='+toEmail+'&subject='+subject+'&html='+message;
                req.setBody('{ "from": "'+fromemail+'",  "to": "'+toEmail+'", "cc":"'+toCCEmail+'", "subject": "'+subject+'",  "html": "'+message+'"}'); 
            }
                
            req.setMethod('POST');   
            req.setEndPoint(mailBody);  
            
            integer iLength = mailBody.length();
            req.setHeader('Content-Length', string.valueOf(iLength));
            
            if( !System.isBatch() && !test.isRunningTest() ) { 
                res = http.send(req);  
            } else{  
                res.setStatusCode(200);
                res.setStatusCode(414);
            }  
            
            String messageID = ''; 
            if( res.getStatusCode() == 200 ){   
                
               System.debug('Email sent');
            }  
            
            status = ''+res.getStatusCode()+''; 
        }
        //return status;
    }
Being required to use Mailgun to track messages being sent through Salesforce. I have looked into and tried to integrate with SalesForceSMTP, but everytime I turn the relay on (active), no emails are delivered (test or "real"). Has anyone successfully done so? Can you share what you did? Thank you!
hiii
i want to create a vf page on which i have two object one opportunity and task.
i have created the vf and controller bt i m facing the problem that how to a fetch the value of opportunity and on those opportunity we have task i a single query.
i m not abe to create a relationship query .Can anyone please help me 
Hi,

My javascript functio like below:

function MyFunction(iserror){
     //alert(iserror);
     if(iserror == true)
     {
     alert('Hello');
   
    }
    return false;
}

<apex:outputLink value="/apex/MyPage?RecId={!UR.Id}&ConId={!cid}" onclick="MyFunction({!isError})" >{!UR.Number__c}</apex:outputLink>

please help me..
Hi,
       I have one  Cancel__c(checkbox) on  custom object.Whenever this checkbox gets checked, a trigger should fire and update the Discount percentage field to 70% How?

please help me.....
  • October 02, 2014
  • Like
  • 0
Hi,
      Using below code i displayed outputfields,but how to retrive these fields related values?

page:
......
<apex:page id="pageId" standardcontroller="Account" extensions="Detailpage1Cls"> 
<apex:form id="formId"> 
    <apex:pageblock id="pbId"> 
        <apex:pageblocksection columns="1" id="pbsIs"> 
            <apex:repeat value="{!$ObjectType.Account.FieldSets.account_fields}" var="f"> 
                <apex:outputField value="{!Account[f]}"/> 
            </apex:repeat> 
        </apex:pageblocksection> 
    </apex:pageblock> 
</apex:form> 
</apex:page>

Controller
----------------
public class Detailpage1Cls {

public List<Account> records{get; set;}

    public Detailpage1Cls(ApexPages.StandardController controller) {

        records=new List<Account>();
       
        records=[SELECT name,phone,fax FROM Account];
    }

}

help me......
Adderror method doesn't display error message, i tried the following Trigger.New[0].name.adderror('Duplicate entry found. There already exists an entry for the same Record. Please update the old one');
Hi ,
                    I have one object name like custom_object__c((a junction object between the Contact and the myobject__c  that notes the files that were viewed and when they were viewed))

when listing these records, show them just like the search results are displayed (same columns, links, etc). Add another column labeled “View date/time” that shows the created date/time of the custom_object__c record How?

help me..
Hi,
        I displayed all records with in the pageblock table.In this pageblock table i gave one column as a Commandlink, when user click this command link ,how to display detail page for that record(customly like output fields)?

please help me....
  • September 07, 2014
  • Like
  • 0
Hi folks
As a newbie to SF, can someone explain to me why nothing I do actually updates my record AND activates my trigger?
I have a trigger on Opportunity to a custom object. It creates a record based on the stage value. Trigger and Class work in sandbox.
I'm trying to get test coverage and I'm running into a roadblock.

I have managed to update a StageName value in the Test class but it didn't call the trigger. (which is supposed to update a previous custom object record and create a new one with the new StageName).
I tried putting in Test.startTest(); and Test.stopTest(); but it didn't make a difference. 
I tried creating bulk records, but only succeeded in creating multiple initial inserts, but did not manage to call the update part of the trigger.
I tried a single opportunity test record, and did update the value in StageName but did not call the trigger.
I'm still trying with a single record and have the test code below.  Please can someone explain to me what I clearly don't understand? Thanks
@isTest
public class TestOppStageHistory {

    static testmethod void createInsOppData() {
        
        Test.startTest();
        
        //Create an opportunity
        Opportunity insOpp = new Opportunity();
        insOpp.Name = 'TestUpdate';
        insOpp.StageName = 'Qualification/Prospecting';
        insOpp.Probability = 1;
        insOpp.CloseDate = date.TODAY() + 10;
        insOpp.Type = 'New Business';
        insert insOpp;

      
        //Test to see if opportunity stage history record was created
        List<Opportunity> insTestOpps = [Select Id, StageName FROM Opportunity WHERE Id = :insOpp.Id];
        String stval1 = insTestOpps[0].Id;   
        System.debug('Value of Id in Opportunity in record is ' + stval1);
            
        Opportunity_Stage_History__c newOppsh = [Select Id, Opportunity__c, Stage__c, Start_Date__c, Completion_Date__c 
                                                 FROM Opportunity_Stage_History__c WHERE Opportunity__c = :insOpp.Id];

        System.assertEquals(newOppsh.Stage__c, insOpp.StageName);
        System.assertEquals(newOppsh.Start_Date__c, date.TODAY());
        System.assertEquals(newOppsh.Completion_Date__c, NULL);
        System.assertEquals(newOppsh.Opportunity__c, insOpp.Id);
            
        //Do we have the right values?
        List<Opportunity_Stage_History__c> insertedShRecs= [SELECT Id, Stage__c, Start_Date__c, Completion_Date__c, Opportunity__c
                                                            FROM Opportunity_Stage_History__c WHERE Opportunity__c = : insOpp.Id ];
        System.debug('The number of recs in the list is ' + insertedShRecs.size());
        String stval2 = insertedShRecs[0].Stage__c;   
        System.debug('Value of Stage__c in record is ' + stval2);
        

        //update StageName on opportunity

        Opportunity updOpp = [SELECT Id, StageName, Probability FROM Opportunity WHERE Id= :insOpp.Id];
        String stval3 = updOpp.Id;
        System.debug('Value of Id in updOpp record is ' + stval3); 
        String stval4 = updOpp.StageName;
        System.debug('Value of StageName in updOpp record is '+stval4);
        
        updOpp.StageName = 'Needs Analysis';
        updOpp.Probability = 25;
        //update.updOpp(); - can't do this. Do I need to map something? Do I need to break to two methods - how to use same record?
        
        Test.stopTest();
        
    }
    
}

Hi champs

I Have a page displays a repeat block of consignment and followingly its items. One consignment could have more than 1.

repeat tag placed inside the pageblock with the id for suppose "pb"

one command button inside this repeat does some action after completion of action wanted to rerender the block "pb"  

I am experiencing wierd behaviour on block rerender latest update values are appearing for only items but not for the consignment. If i refresh the whole page,
page loading with the latest values.


What wrong would be the reason for this behaviour.

Please can i be provided any suggestions 

Hi All,

I am getting a error while going to reset password for portel users.

Error: - Passwords for one or more external users were unable to be reset because the external users do not belong to any active community.

Please help me on this.

Thanks,
Madan

Hi my header name goes away when I render the column but the value comes up???

 

<apex:column rendered="{!dd.TermD='9.2'}">
<apex:facet name="header">Subject Area</apex:facet>
<apex:outputText value="{!dd.Subject}"/>
</apex:column>

 

 Thanks

 

Message Edited by MMA_FORCE on 03-19-2010 11:07 AM