• vbs
  • SMARTIE
  • 855 Points
  • Member since 2013

  • Chatter
    Feed
  • 28
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 220
    Replies
Hi,

I have got a visualforce page, where I am showing in a table a list of cases I get from my Apex Class.

This is my visualforce:

<apex:page controller="XMLCasePopupController" title="Search" showHeader="false" sideBar="false" tabStyle="Case" id="page" >
  <!-- messages -->
  <apex:outputPanel id="top" layout="block">
    <apex:outputLabel value="Possible duplicates" style="margin:20px; padding:10px; margin-top:10px; font-weight:bold; font-size: 1.5em;"/>
  </apex:outputPanel>

  <apex:form >
  <apex:pageBlock title="XML Case Edit" id="XML_Case_Edit" mode="Edit">
      <!-- Buttons toolbar -->   
        <apex:pageBlockButtons >
            <apex:commandButton value="Finish" action="{!endCaseCreation}"/>
        <!--    <apex:commandButton value="Back" action="{!backStep}"/> -->
        </apex:PageBlockButtons>
      
        <apex:outputPanel id="page" layout="block" style="margin:5px;padding:10px;padding-top:2px;">
  <apex:actionRegion >
      <!-- results panel -->
      <apex:outputPanel id="pnlSearchResults" style="margin:10px;height:350px;overflow-Y:auto;" layout="block">
          <apex:pageBlock id="searchResults">
             <apex:pageBlockTable value="{!results}" var="c" id="tblResults">
                    <apex:column >
                    <apex:facet name="header">
                        <apex:outputPanel >Release</apex:outputPanel>
                    </apex:facet>
                    <apex:outputLink onClick="test('{!c.Id}');return false;">{!c.Module_Release__c}</apex:outputLink>
                    </apex:column>
</apex:column>
             </apex:pageBlockTable>
         </apex:pageBlock>
      </apex:outputPanel>
  </apex:actionRegion>
  </apex:outputPanel>
    </apex:pageBlock>
    <apex:actionFunction name="test" action="{!ShowCaseToTrue}">
        <apex:param name="param1" assignto="{!IdChosen}" value=""/>
    </apex:actionFunction>
  </apex:form>

So I am calling the actionFunction ShowCaseToTrue and I want to pass the Id of the case that the user has clicked in the table. This is my apex class:

public with sharing class XMLCasePopupController {


  public List<Case> results{get;set;} // search results
  public string searchString{get;set;} // search keyword
  public string caseId{get;set;}
  public Boolean ShowCase{get;set;}
  public Case ChosenCase{get;set;}
  public Id IdChosen{get;set;}

  public XMLCasePopupController() {
    // get the current search string
    searchString = System.currentPageReference().getParameters().get('lksrch');
    caseId = System.currentPageReference().getParameters().get('id');
    //ShowCase=False;
    System.debug('==> searchString = ' + searchString + ' -- caseid ' + caseId);
    runSearch();
  }

  // performs the keyword search
  public PageReference search() {
    runSearch();

    return null;
  }

  // performs the keyword search
  public void ShowCaseToTrue() {
    this.ShowCase=True;
    system.debug('El id que tengo que buscar es: '+ IdChosen);
    ChosenCase=[SELECT Id,CaseNumber FROM Case WHERE Id=:IdChosen];
  }
}

I am always getting a null value in IdChosen. Can anybody help me on what I am missing here?

Thanks a lot!

Antonio
The error is coming when i want to fetch customerUserTypes in Profile.

Set<String> customerUserTypes = new Set<String> {'CSPLiteUser', 'PowerPartner', 'PowerCustomerSuccess',   'CustomerSuccess'};
Account acc = new Account (
Name = 'newAcc1'
); 
insert acc;
Contact con = new Contact (
AccountId = acc.id,
LastName = 'portalTestUser'
);
insert con;
Profile p = [select Id,name from Profile where UserType in :customerUserTypes limit 1];

User newUser = new User(
profileId = p.id,
username = 'newUser@yahoo.com',
email = 'pb@ff.com',
emailencodingkey = 'UTF-8',
localesidkey = 'en_US',
languagelocalekey = 'en_US',
timezonesidkey = 'America/Los_Angeles',
alias='nuser',
lastname='lastname',
contactId = con.id
);
insert newUser;
Hi

Disclosure: not a developer..

I want to have a field update workflow start, but it is based on a formula field and it does not seem that a formula field can start a workflow.

Essentially, I have a formula field on Opportunities called Paid (Paid__c) and when this evaluates to True, I want the Stage (StageName) field to update to Closed Won.  I'd like this to happen in as near to real time as possible - every 15 min?  More frequent, if it wouldn't be problematic...

Is this something that is simple for someone that knows what they are doing or can someone point me in the right direction?
{!REQUIRESCRIPT("/soap/ajax/28.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")}

var retStr;
retStr = sforce.apex.execute("SF_Rockport", "callRockport",{ID:"!Transaction__c.Id}"});

alert('The method returned: ' + retStr);

User-added image

Hello,

 

I have two custom objects. There is a Master-Detail relationship between them.

 

I have created a Master record and a Child record & related this to created Master record.

 

I have created one more Master record. I need to change the Master now.

 

But when I tried to edit the child record, it is showing the related Master lookup field as only readable.

 

Is this a new feature in Winter '14?

 

Is there any other way to change this?

 

Please clarify ASAP.

 

 

Thanks,

Arunkumar

 

 

Hi,

 

I am trying to create a application that does data analytics of a Sales Force CRM user's contacts and leads. Basically I want to pull of the contacts and leads from the Salesforce CRM and send it via REST API to my server to do some analysis on the data. After the analysis is complete, I want to send the data back to the Salesforce CRM.

 

I heard that because Salesforce platform is a multi-tenant environment, there are limitations on how much CPU I can use at any one time. Is a cron job that sends the information over time the best approach? And also can anyone give me some pointers as to what code I need to write to achieve this? I am fairly new to the Salesforce platform but have a good understand of Apex.

 

thanks,

Nick

I have a pageBlockTable with inputcheckbox. I want to count the number of records selected and display the count in the ApexPages.message.

 

Any idea how I can do this? Thanks!!

 

 

VFP


<apex:pageBlockTable value="{!priceist}" var="p" id="results">

<apex:column >
<apex:inputCheckbox value="{!p.selected}" onchange="updateSelectCount(this);"/>
</apex:column>


<apex:column >
...
</apex:column>

</apex:pageBlockTable>
   
   
</apex:pageBlock>

 

//Apex class


 public PageReference approveRecord(){

 

    // my logic and finally


  ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Confirm,'All records successfully approved!'));    // Here instead of 'All' i want {!count}

}

We have a custom button that executes JavaScript on our case record:

{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}
this.disabled=true;
try{
var accId='{!Account.Id}';
var objectId = '{!Case.Id}';

var result = sforce.apex.execute("ForceJiraComm", "createIssue",
{case_id : objectId});
alert(result);
location = location;
}
catch(err) {
txt="There was an error on this page.\n\n";
txt+="Error description: " + err + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
}
this.removeAttribute('disabled');

We want it to also write the full name of the user that clicked the button to the custom field JIRA_Escalated_By__c on the case object.  How do we do this?

Basically, how can update our APEX to store who clicks a custom button?”

L = Database.query('SELECT Id,Name (Select QualificationStatus__c From Qualifications__r where QualificationStatus__c =\'Success\' AND QualificationType__c=:countries) FROM Contact WHERE Firstname= :text');

 

 

Getting error

System.QueryException: unexpected token: 'Select'

 

 

 

 

 

String AppNumber = lastApp.Name
Map<String, String> value = new Map<String, String>();
  value.put('{#AppNumber}', AppNumber);

 Agreement template = new Agreementtemplate();
                template.init(lastProg.Thank_You_Page__c, lastProg.Id, 'Prog__c', value);

In Object__c I have a picklist field called Campaign__c and one of the picklist values is 2014 Charity Run.

 

In my Apex code, how can i avoid hardcoding the Campaign__c value ?

 

 

list <Object__c> obj = [Select id,name, Account__c, Campaign__c

                                   from Object__c

                                   Where Campaign__c=:'2014 Charity Run'];

 

 

 

Is custom setting the way to go?

 

 

 

 

 

 

 

 

 

 

Hello,

 

This Trigger is copying some fields from Accoun to IMP__C Custom Object. It's working fine.

 

There is a field on Account "IsClosed" (standard field) , it's a checkbox. I need to copy the value of this check box to IMP__c. Means when checkbox is true it should update value on IMP__C "closed" field as True. I am not sure how to write this in this trigger?

 

trigger insertfielddat on Account(after insert,after update) {

 

    Set<String> AccountTitle= new Set<String>();

    Set<String> setAccount = new Set<String>();

    List<Account> listAccount = new List<Account>();

    Map<String, IMP__c> mapImp = new Map<String, IMP__c>();

    List<IMP__c> listImp = new List<IMP__c>();

    List<IMP__c> listUpdtImp = new List<IMP__c>();

   

    if (Trigger.isInsert){

        for (Account Accounts : Trigger.new)

        {

          

              IMP__c imp = new  IMP__c(Name = Accounts.title,BR_ID__c=Accounts.Account__c,Description__c=Accounts.Body,Region_User__c=Accounts.Region__c);

              listImp.add(imp);

          

        }

        insert listImp;

    }

    if (Trigger.isUpdate){

        for (Account Accounts : Trigger.new)

        {

            

              listAccount .add(Accounts );

              setAccount.add(Accounts.Account__c);

                             

             }

 

   

   

            listImp  = [select Name,BR_ID__c,Description__c,Region_User__c from IMP__c where  BR_ID__c in :setAccount];

        for( IMP__c imptmp : listImp ){

            mapImp.put(imptmp.BR_ID__c,imptmp);

        }

        for( Account Accounttmp : listAccount  ){

            if( mapImp.get(Accounttmp.Account__c) != null ){

                 IMP__c uptIMP = mapImp.get(Accounttmp.Account__c);

                  

                

                 uptIMP.Description__c=Accounttmp.Body;

                 uptIMP.Name  = Accounttmp.title;  

                 uptIMP.Region_User__c   =Accounttmp.Region__c;

                 listUpdtImp.add(uptIMP);

            }else{

                 IMP__c imp = new  IMP__c(Name = Accounttmp.title,BR_ID__c=Accounttmp.Account__c,Description__c=Accounttmp.Body,Region_User__c=Accounttmp.Region__c);

                 listUpdtImp.add(imp);

            }

        }

        upsert listUpdtImp;

    

    }

    }

 

 

Please Help!

 

Richa

Hello,

Can anyone help to write a logic to merge duplicate records of Custom Object?

 

Thanks,

Shruti

I have a picklist that I am trying to generate from a class.  The idea is that when a user picks an item from the list that they will be redirected to the corresponding page.  When I use the code snippet below in a test page where the class is set as the "Controller=class" it works great.  However, when I add the class to another page as "extensions=class", the drop down list will not render any values.

 

Any ideas on how to get this to render properly.

 

Visualforce:

 

<apex:page standardController="Task" extensions="taskManagementRedirectPicklist" tabStyle="Task">
<apex:form >	
	<apex:pageBlock title="Selection Criteria">		
		
		<apex:pageBlockSection showHeader="false" title="Options" columns="3">
			<apex:pageBlockSectionItem >
				
				<apex:selectList value="{!picklistvalue}" size="1" >
			    	<Apex:selectOptions value="{!item}"/>
			    	<apex:actionSupport event="onchange" action="{!redirect}" />    
			    </apex:selectList>
			    		
			</apex:pageBlockSectionItem>
	    </apex:pageBlockSection>
	</apex:pageBlock>
</apex:form>
</apex:page>

 

Apex Class:

 

public with sharing class taskManagementRedirectPicklist {
	
	private ApexPages.StandardController controller;
	
	public taskManagementRedirectPicklist(ApexPages.StandardController stdController) {
      controller = stdController;
   }   
	
	public list<selectoption>item{get;set;}
	public string picklistvalue{get;set;}
	
	public taskManagementRedirectPicklist()
	{
	    item=new list<selectoption>();
	    item.add(new selectoption('myTasks','Tasks Assigned to Me'));
	    item.add(new selectoption('myDelegatedTasks','Tasks I Assigned to Others'));
	}
 
	public pagereference redirect()
	{
	     PageReference pageRef= new PageReference('/apex/'+picklistvalue);
	    pageRef.setredirect(true);
	    return pageRef;
	}

}

 

Hi,

 

I want to write the trigger which send the email notifications when the case is closed.

 

Can any one help for this?

 

 

Regards.,

R.Ambiga

Hi All,

      Requirement is to upload a CSV file which carries multilingual character and Special characters into Salesforce using custom functionality [using VF and apex], but when I try to upload that file and converting blob to String getting error as 'Blob is Invalid UTF -8 String' .How to solve this issues.

Hi Friends ,

Can anyone help me in resolving this code .

Error: Compile Error: Method does not exist or incorrect signature: [String].day() at line 19 column 37

 

// memberBirthdayBatch:

global class memberBirthdayBatch implements Database.batchable<Member__c>
{
global Iterable<Member__c> start(Database.batchableContext info)
{
System.debug('Start method');
return new callMemberIterable();
}
global void execute(Database.batchableContext info, List<Member__c> scope)
{
List<Member__c> memsToUpdate = new List<Member__c>();
System.debug('Member list size is ' + scope.size());
for(Member__c m : scope)
{
Date myDate = date.today();
Integer todayDy = myDate.day();
Integer todayMon = myDate.month();
System.debug('Day is ' + m.BirthDay__c.day());
Integer dy = m.BirthDay__c.day();
Integer mon = m.BirthDay__c.month();
if(todayDy == dy && todayMon == mon)
{
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
List<String> toAddresses = new List<String>();
toAddresses.add(m.EmailAddress__c);
email.setToAddresses(toAddresses);
List<String> ccAddresses = new List<String>();
ccAddresses.add('salesforcecrm@gmail.com');
email.setCcAddresses(ccAddresses);
email.setSubject('Happy Birthday. Have a blast -- Birthday Reminder!');
String message = '<html><table cellspacing = "7"><tr><td style="font-weight:bold;color:green;">Happy Birthday!!!</td></tr><tr><td style="font-weight:bold;color:pink;">Many more Happy returns of the day.</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td style="font-weight:bold;">Cheers,</td></tr><tr><td style="font-weight:bold;">XYZ</td></tr></table></html>';
email.setHtmlBody(message);
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{email});
}
}
}
global void finish(Database.batchableContext info)
{
}
}

 

Thanks in advance

 

I am attempting to write a SOQL query to find the following.   Having trouble with the "join" etc.

 

We have a Custom Object called Shipment, the parent object is Account. 

 

Related by:

Shipment.SF_Account__c = Account.Id

 

Shipment has a field called CustomerNo.  Account has a field Site.   I want a list of Shipment records where CustomerNo does NOT equal the related Account Site.

 

In SQL it would look like:

SELECT Shipment.ID, Shipment.CustomerNo, Account.Site FROM Shipment INNER JOIN Account ON Shipment.SF_Account__c = Account.ID WHERE Shipment.CustomerNo <> Account.Site