• avijchak
  • NEWBIE
  • 40 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 26
    Replies

Hey everyone

I'm trying to create a responsive visualforce page, only rerendering the proper pageblocks etc. when needed to avoid doing full page rerenders. BUT I use <apex:messages/> to display error messages and I've not been able to get the apex:messages component to update without doing a full page rerender.

I've tried something like this:

<apex:messages id="msgBlock"/>

...
<apex:commandButton action="{!someMethod} value="button" rerender="msgBlock"/>

 Does anyone know how to do this or something with a simular functionality?

 

Thanks

Ronni

  • March 05, 2013
  • Like
  • 0

i have two Objects Product_Master__c and Order_Product__c having look up relation,how can i get the updation of  Product_Master__c  look up fields in Order_Product__c   when i select Product master record in Order Product all the look up fields in Order Product should be updated

I am looking for helping bulkifying a trigger I wrote that updates the Owner on Account.  I understand the concept of bulkifying and tried reviewing other posts where people have requested similar help, but am at a loss.  I'm a beginner and learning and happy to just have created the trigger below...any help in bulkifying is appreciated.  Also, does bulkifying this trigger mean that the test class I wrote also needs to be updated?

 

trigger UpdateOrganizationOwner on Account (before insert, before update) {
for (Account a : trigger.new) {

if (a.RecordTypeId == '012000000000000'&& a.RM_ID__c!=null) {
  a.OwnerId = a.RM_User_ID__c;
  }
 }
}

 

 

 

 

ok so hopefully i explain this correctly. So i have a VF page i have created (code will be below) that captures data from the user. What i need to have happen is when the record is saved it should be associated with a parent campaign. So the campaign is the master detail reocrd i want to have all records from the VF page associated with. I have the VF page working and am trying to right a controller to connect the master detail record (campaign Id) to the child record.

 

So in short user goes to VF page fills in data and when they hit save system relates this record to a campaign. Is this even possible?

 

VF Code:

 

<apex:page standardController="Spiff_Request__c">
  <apex:form >
    <apex:pageBlock title="Spiff Request" mode="Create">
                  
              <apex:pageBlockButtons >
                <apex:commandButton action="{!edit}" id="editButton" value="Edit"/>
                <apex:commandButton action="{!save}" id="saveButton" value="Save"/>
                <apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel"/>
              </apex:pageBlockButtons>

     <apex:pageBlockSection title="Spiff Request" columns="2">
         <apex:inputField value="{!Spiff_Request__c.When_was_date_of_Meeting__c}"/> <br></br>
         <apex:inputField value="{!Spiff_Request__c.Product_Interest__c}"/> <br></br>
         <apex:inputField value="{!Spiff_Request__c.New_Customer__c}"/> <br></br>
         <apex:inputField value="{!Spiff_Request__c.Reseller_Company_Name__c}"/>
         <apex:inputField value="{!Spiff_Request__c.Customer_Name__c}"/>
         <apex:inputField value="{!Spiff_Request__c.Reseller_Phone__c}"/>
         <apex:inputField value="{!Spiff_Request__c.Customer_Phone__c}"/>
         <apex:inputField value="{!Spiff_Request__c.Address_to_send_Spiff_to__c}"/>
         <apex:inputField value="{!Spiff_Request__c.Customer_Address__c}"/>
         <apex:inputField value="{!Spiff_Request__c.Who_Attended_Partner_Imperva__c}"/>
         <apex:inputField value="{!Spiff_Request__c.Who_Attended_Customer__c}"/>
         <apex:inputField value="{!Spiff_Request__c.Additional_Details__c}"/>
     </apex:pageBlockSection>
 
    </apex:pageBlock>
  </apex:form>
</apex:page>
             

Controller class code: (this is where im trying to pass the ID to match child recod to parent (the error i get is :

Save error: Initial term of field expression must be a concrete SObject: String)

 

public

withsharingclass CampaignID {

publicCampaign campaignID       {get;set;}

public CampaignID(ApexPages.StandardController sc)

 

{

 

  campaignID = sc.getID()campaign_ID;

 

}

public PageReference saveAndReject() {

 

PageReference requestPage = Page.AccountRecord;

requestPage.getParameters().put(campaignID,

Spiff_Request__c.CampaignID__c);

requestPage.setRedirect(

true);

return

requestPage;

 

}

}

 

I havent added the controller into the VF code yet becasue i cant get it to save.

 

Thanks for all replys....

 

Hi,

 

could anyone guide me of how to make deployments. I have the name of sandbox, where I need to deploy it to.
Do I use eclipse? How can I make sure that the test coverage is the same in deployment as in my own sandbox?

 

Thanks

 

 

Anika

HI ,

 

Can anyone help me out how to redirect user automatically into some other page ,when i click on redirect to account link.pageReference method will call and it will take me into account page , but i want to perform this action automatically.

Below is the my code.

 

<apex:commandLink value="Redirect to Account" style="color:blue; font-weight:bold;" action="{!RedirecttoAccount}"
rendered="{!Not(Display)}"/>
  </center>

 

 

public PageReference RedirecttoAccount() {
     PageReference Page = new ApexPages.StandardController(acc).view();
     Page.setRedirect(true);
     Return Page; }

 

 

Hey everyone

I'm trying to create a responsive visualforce page, only rerendering the proper pageblocks etc. when needed to avoid doing full page rerenders. BUT I use <apex:messages/> to display error messages and I've not been able to get the apex:messages component to update without doing a full page rerender.

I've tried something like this:

<apex:messages id="msgBlock"/>

...
<apex:commandButton action="{!someMethod} value="button" rerender="msgBlock"/>

 Does anyone know how to do this or something with a simular functionality?

 

Thanks

Ronni

  • March 05, 2013
  • Like
  • 0

Hi,

 

Help needed.

 

I have a Text field with the hours of now() func. I want to subtract 14 hrs from that num.

 

So I wanna know how to move the values of text to number field.

 

Any help is highly appreciated..

 

Thanks

  • March 05, 2013
  • Like
  • 0

Hi,

    i have a situation,i.e when i update a record then it must compare previous value of name with present value of Name.Thus two Names must not be same. For this,i wrote trigger as well as validation.Both are working but when i edit record for changing the other field and i click save,again it shows error.But we dnt want that,we need logic executed only for particular Name updated.

Can anyone suggest me the logic for trigger or validation...

 

Trigger:

trigger old_New_comparison on Employee__c (after update) {
for(Employee__c e:Trigger.New){
Employee__c oldvalue=trigger.oldMap.get(e.id);
if(e.Name==oldvalue.Name){
e.Name.adderror('Please Change the Name');

}
}

 

Validation:

AND( ISCHANGED( Name ) ,  NOT(PRIORVALUE( Name )   =    Name)  )

 

Hello,

Could anybody help me in the below scenario.

Currently we have application in some other language and we are trying to migrate it to salesforce.

In the application  Javascript is dynamically created in code which generate the UI part.So I am trying for the same functionality that I need to write the same Javascript code through Apex Code which dynamically generate the interface.

Is it possible to write whole javascript in apex Code and what need to be taken care when moving(migrating) the same to Force.com

Hello Salesforce Gurus,

 

  I need help with this exception: System.QueryException: Non-selective query against large object type (more than 100000 rows)

 

  Following is the query where I get the exception: select Opportunity_Number__c,Id 

from Opportunity where Opportunity_Number__c in :LstOpptyNbrs

 

  Now Opportunity_Number__c is Text(255) (External ID) (Unique Case Sensitive). Salesforce suggests that if the dataset is large than the query should contain filters against indexed fields, which I am doing here. Moreover I get this exception when a record is sent from another SF instance in a SF - SF integration.

 

Thanks & Regards,

K

Hi, 

 

I am trying to deploy from sandbox to production, and every object is showing up in the "Add" section. Looking at the IDE Log viewer it looks like I am getting a "Deploy to retrieve" ServiceException: UNKNOWN_EXCEPTION. I created a case with SFDC support, just waiting to hear back. Here is the partial stack trace:

 

WARN [2013-03-04 09:05:16,102] (BasePackageService.java:waitForResult:144) - Deploy or retrieve operation to 'https://na9-api.salesforce.com/services/Soap/m/26.0/xxxx' failed: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 819342941-5767 (263768281) (UNKNOWN_EXCEPTION)
WARN [2013-03-04 09:05:16,112] (PackageRetrieveService.java:retrieveWork:1062) - Unable to retrieve components: ServiceException: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 819342941-5767 (263768281) (UNKNOWN_EXCEPTION)
WARN [2013-03-04 09:05:16,124] (DeploymentController.java:generateDeploymentPayload:335) - Unable to retrieve remote components for resources
com.salesforce.ide.core.services.ServiceException: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support: 819342941-5767 (263768281) (UNKNOWN_EXCEPTION)
at com.salesforce.ide.core.services.BasePackageService.waitForResult(BasePackageService.java:151)
at com.salesforce.ide.core.services.PackageRetrieveService.getRetrieveResult(PackageRetrieveService.java:941)
at com.salesforce.ide.core.services.PackageRetrieveService.retrieveWork(PackageRetrieveService.java:1053)
at com.salesforce.ide.core.services.PackageRetrieveService.retrieveWork(PackageRetrieveService.java:1006)
at com.salesforce.ide.core.services.PackageRetrieveService.retrievePackage(PackageRetrieveService.java:319)
at com.salesforce.ide.deployment.ui.wizards.DeploymentController.handleSourceRetrieve(DeploymentController.java:462)
at com.salesforce.ide.deployment.ui.wizards.DeploymentController.loadRemoteProjectPackageList(DeploymentController.java:425)
at com.salesforce.ide.deployment.ui.wizards.DeploymentController.generateDeploymentPayload(DeploymentController.java:333)
at com.salesforce.ide.deployment.ui.wizards.DeploymentController.generateDeploymentPayload(DeploymentController.java:251)
at com.salesforce.ide.deployment.ui.wizards.DeploymentPlanPage$1.run(DeploymentPlanPage.java:141)

 

Anyone else having issues with this, and/or know what might be causing it?

Hi All,

 

I've created a custom object with many fields. Now I want to show them in the Lead Page Layout at the top

 

I've created a lookup field in Lead to point my newly custom object and also in the Opportunity (as this field content will be converted)

 

The reason to create custom object is that I passed the limit of custom fields.

 

I'm doing my first step writing pages and not I understand that I cannot use the StandardController of my newly object as it will not be shown in the Lead.

 

I need to create an apex class wrapping my object.

 

I also need to show my custom page in the Opportunity Page Layout.

 

What will be the best way doing so?

 

Thanks

Uri

  • March 03, 2013
  • Like
  • 0

I have a home page component at left side which shows a tree view of a logged in user and his subordinates. When User choose some users from the tree using checkbox and click a button below, I can get the Ids of all selected user. In the right side of the page I have a Custom Visualforce Page, I want to pass the Selected User Ids to the page having in right side. I am doing it wsing Javascript (top.window.location.href = "{!newUrl}"). But when The {!newUrl} string too big then the right side page not loaded. Showing blank page. How can I pass the {!newUrl} val to the right side page.

 

NOTE: {!newUrl} is the url of the right side Visualforce page with Selected Id as querystring. I want to refresh the right side page according to the selected user Id values.

 

Thanks.

How do i retrieve a list of all contacts available in my contacts tab and display them on a Visualforce page.

Hi All,

 

If opportunity stage should to close user have to upload a doc for this i wrote a trigger its working good, now issue is if that attachment is deleted ,opportunity stage should be old value what i have to do how i can wrote trigger on notes and attachment help me

  • February 26, 2013
  • Like
  • 0

Hi All,

 

i am displaying data using pageblocktable. i just want to add comma to column values which are displaying  how can i achive this .

 

Thanks,

Harsha

Hi All,

 

I have a Apex Class. THis is used in creating new cases. THe problem is if I create a validation rules it throw an error  when new cases is created. I am not sure why this is happening as I didn't write this code. Any help is appreciated.

 

Error: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please select Type and Category:

Error is in expression '{!insertAndRedirect}' in component <apex:page> in page cases_new

 

An unexpected error has occurred. Your development organization has been notified

 

Code:

public with sharing class cases_Extension {

    public case thisCase {get;set;}
    public List<Case> theseCases {get;set;}
    
    public cases_Extension(ApexPages.StandardController controller){
        this.thisCase = (Case) controller.getRecord();
        this.theseCases = new List<Case>();
    }
    
    public cases_Extension(ApexPages.StandardSetController controller){
        this.theseCases = (List<Case>) controller.getRecords();
    }


    public PageReference insertAndRedirect(){
        //If DID__c is populated, Query DIDs
        if ( thisCase.Did__c != null && (thisCase.AccountId == null || thisCase.ContactId == null )){
            List<DID__c> didQuery = [Select Id, Account__c, Contact__c from DID__c where Id = :thisCase.Did__c limit 1];
            if ( didQuery.size() > 0 ){
                DID__c thisDid = didQuery[0];
                if ( thisCase.AccountId == null && thisDID.Account__c != null ){
                    thisCase.AccountId = thisDID.Account__c;
                } 
                if ( thisCase.ContactId == null && thisDID.Contact__c != null ){
                    thisCase.ContactId = thisDID.Contact__c;
                } 
            } 
        }


        insert thisCase;
        String url = '/'+thisCase.id+'/e?retURL=' + EncodingUtil.urlEncode('/500/o','UTF-8');
        PageReference p = new PageReference(url);
        return p;
    }

    public PageReference getNextCase(){
        //Determine current user
        Id userId = userinfo.getUserId();
        Set<Id> listQueueIds = new Set<id>();
        Set<Id> myQueueIds = new Set<id>();
        List<Case> caseQuery = new List<Case>();
        
        if ( theseCases.size() > 0 ){
            for ( Case c : theseCases ){
                if ( string.valueOf(theseCases[0].OwnerId).subString(0,3) != '005' ){
                    myQueueIds.add( theseCases[0].OwnerId );
                }
            }
            if ( myQueueIds.size() > 0 ){
                caseQuery = [Select Id, CreatedDate, IsClosed from Case where OwnerId in :myqueueIds and IsClosed != TRUE order by CreatedDate asc limit 1];
            }
        }

        if ( caseQuery.size() == 0){
            for ( GroupMember gm : [Select UserOrGroupId, Group.Type, Group.RelatedId, Group.Name, GroupId From GroupMember where Group.Type = 'Queue' and UserOrGroupId = :userId]){
                listQueueIds.add(gm.GroupId);
            }
            caseQuery = [Select Id, CreatedDate, IsClosed from Case where OwnerId in :listQueueIds and IsClosed != TRUE order by CreatedDate asc limit 1];
        }

        if ( caseQuery.size() > 0 ){
            thisCase = caseQuery[0];
            thisCase.OwnerId = userId;
            update thisCase;
            PageReference p = new PageReference('/'+thisCase.id);
            return p;
        } else {
            PageReference p = new PageReference('/500/o');
            return p;
        }
    }

    public PageReference replyToCase(){
        if ( string.valueOf(thisCase.OwnerId).subString(0,3) != '005' ){
            thisCase.OwnerId = userInfo.getUserId();
            update thisCase;
        }
        String templateId = '00X60000000xlFf';  //Sandbox
//      String templateId = '00XR0000000MJWr';  //Production
        
        PageReference p = new PageReference('/_ui/core/email/author/EmailAuthor?p2_lkid='+ thisCase.ContactId + '&p3_lkid=' +  thisCase.Id + '&rtype=003&template_id=' + templateId + '&p26=' + thisCase.From__c + '&retURL=%2F' + thisCase.Id);
        p.setRedirect(true);
        return p;
    }

}

  • February 24, 2013
  • Like
  • 0

Hello,

Could anybody help me in the below scenario.

Currently we have application in some other language and we are trying to migrate it to salesforce.

In the application  Javascript is dynamically created in code which generate the UI part.So I am trying for the same functionality that I need to write the same Javascript code through Apex Code which dynamically generate the interface.

Is it possible to write whole javascript in apex Code and what need to be taken care when moving(migrating) the same to Force.com