• pooja@magichorse.com
  • NEWBIE
  • 60 Points
  • Member since 2013

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

I am trying to call the Account name of a contact as follows:

 

public with sharing class mainSub {

public PageReference sendpassfail() {
Account_name = SELECT Account.Name, (SELECT Contact.FirstName FROM Contact Where Contact.LastName = 'Steve') FROM Account

}
}

 

But this gives me the following error:

 

unexpected token: 'SELECT' at line ----

 

Can someone tell me why?

Thanks,

Is there any way to remove "Del" (Delete) link from related list?

In Opportunity related list, it shows "Edit|Del" link for every record under Action column. I want to remove "Del" link from related list-records.

 

Any one has idea about this?

Is there any way to remove "Del" (Delete) link from related list?

In Opportunity related list, it shows "Edit|Del" link for every record under Action column. I want to remove "Del" link from related list-records.

 

Any one has idea about this?

What are the methods are involved while deploying the Apex class and trigger ?

 

Thank u in Advance.

Hi 

 

in my VF page i want to render a related list only for one logged in user . can any one provide me the Syntax

 

This is a Standard controller on contact

 

here are the ways i am trying and no success yet

 

<apex:relatedList list="Executive_Notes__r" rendered="{$USER.id = '222222222"}/>

 

and i cretaed a formula filed on contacts to get the logged in person id and check it but even that doesnt work.

 

<apex:relatedList list="Executive_Notes__r" rendered="{!(Contact.Executive_Note__c == '005300000040xoB' )}"/>

 

Thanks

  • August 27, 2013
  • Like
  • 0

i need programatic code  explantion ple any one have ideal send me .

How to send  token to sfdc people from our developer edition ?hank u 

 

 

if know any one ple suggest me .

 

thank u .

Hi all,

 

Can anyone tell me how to collect the Email Ids from (custom Object  Employee  ) the list view displaying Employee Email Id List .

 

   

I Want send  a mail for that selected List of Mail  , when i click the send mass email button. it has to collect id of the selected Employee Object and mail to the record.

 

Can anyone give me a solution for this?

 

Hi,

 

Using wrapper class im retriving Account and case details.

I want to disply like this in VF page ,

 

if i use pageblocktable,im getting all data in row from wrapperList..

 

 

  • August 27, 2013
  • Like
  • 0

Is there any way to remove "Del" (Delete) link from related list?

In Opportunity related list, it shows "Edit|Del" link for every record under Action column. I want to remove "Del" link from related list-records.

 

Any one has idea about this?

I am trying to call the Account name of a contact as follows:

 

public with sharing class mainSub {

public PageReference sendpassfail() {
Account_name = SELECT Account.Name, (SELECT Contact.FirstName FROM Contact Where Contact.LastName = 'Steve') FROM Account

}
}

 

But this gives me the following error:

 

unexpected token: 'SELECT' at line ----

 

Can someone tell me why?

Thanks,

Greetings! Is there a way to copy all the opportunities from the accounts into a custom object called Account_Plan__c?

 

Let me try be more clear:

 

I have an object Called Account_plan__c, and i have a lookup field to Accounts, so what i'm looking is to get:

 

A) 1 related list  with all the opps for the current quarter from that account

B) 1 related list with all won opps from that account

C) 1 related list with all lost opps from that account

 

The 3 related list must be filtered by user profile.

 

Thank you!!!!

Hi,

This is my first post on the board and am hoping someone can help!

I created a trigger to populate a custom Task field (Opportunity_Close_Date__c) with the Opportunity Close Date. 

Below please find my trigger and the test class I wrote.

 

The problem is that I'm getting 100% code coverage but the test is failing (Error Message: System.AssertException: Assertion Failed).

 

Any ideas or help would be greatly appreciated!!

Thanks!

 

Here's the trigger:

 

trigger OppCloseDate on Opportunity (after insert, after update) {

Set<Id> oppIds = new Set<Id>();
Set<Id> taskIds = new Set<Id>();{
for(Task t:[select Id, WhatID from Task]){
        String wId = t.WhatId;
        if(wId!=null && wId.startsWith('006')){
            taskids.add(t.WhatId);
for(Opportunity to:[select Id from Opportunity where Id in :taskIds]){
        oppIds.add(to.ID);
    }
    Set<Id> oppstoupdate = new Set<Id>();
    for(Integer i=0;i<trigger.new.size();i++){
        if(oppIds.contains(trigger.new[i].Id)){
            oppstoupdate.add(Trigger.new[i].id);

if(oppstoupdate.size() > 0){

   List<Opportunity> oList = [select Id, CloseDate from Opportunity where Id in :oppstoupdate];
    
   List<Task> taskstoupdate = new List<Task>();{
   for(Task tsk : [select Id, Opportunity_Close_Date__c from Task where WhatId in :oppstoupdate]){
   tsk.Opportunity_Close_Date__c = oList[0].CloseDate;
   taskstoupdate.add(tsk);
            }
        }
             if(!taskstoupdate.isEmpty()){
            update taskstoupdate;
        }
        }
        }
        }
        }
        }
        }
        }

 

And here's the test class:

 

@isTest

private class Test_OppCloseDate {
  
    public static testMethod void myUnitTest(){

 List<Opportunity> opp1 = new List<Opportunity>{ new Opportunity(
        Name = 'Test Opp1',
        StageName = 'Closed Won',
        Type = 'New Business',
        CloseDate = Date.today()+7,
        Demo_ID__c = NULL,
        LicenseType__c = 'Enterprise')};                                
       
    insert opp1;
 
List<Opportunity> opp2 = new List<Opportunity>{ new Opportunity(
        Name = 'Test Opp2',
        StageName = 'Closed Won',
        Type = 'New Business',
        CloseDate = Date.today()+2,
        LicenseType__c = 'Enterprise')};                                
       
    insert opp2;

List<Task> tsk1 = new List<Task>{ new Task(
    WhatId = opp1[0].id,
    Subject = 'Task 2',
    Status = 'Not Started',
    Priority = 'Normal',
    Type = 'Demonstration - In Person')};                                
        
    insert tsk1;
    
  
List<Task> tsk2 = new List<Task>{ new Task(
    WhatId = NULL,
    Subject = 'Task 2',
    Status = 'Not Started',
    Priority = 'Normal',
    Type = 'Demonstration - Web/Phone')};                                
        
    insert tsk2;
    
List<Opportunity> oppstoupdate1 = New List<Opportunity>{ [select id from Opportunity where id in :opp1]};
    for(Opportunity oOP:oppstoupdate1)
    oOP.CloseDate = Date.today();
        Update oppstoupdate1;

List<Task> taskstoupdate2 = New List<Task>{ [select id from task where id in :tsk2]};
    for(task tOK:taskstoupdate2)
    tOK.WhatId = opp2[0].id;
        Update taskstoupdate2;


Task [] tasks1 = [select ID, Opportunity_Close_Date__c from Task where ID in :tsk1];
    System.assert(tasks1[0].Opportunity_Close_Date__c == (opp1[0].CloseDate));

Task [] tasks2 = [select ID, Opportunity_Close_Date__c from Task where ID in :tsk2];
    System.assert(tasks2[0].Opportunity_Close_Date__c == (opp2[0].CloseDate));  
 }
 }

 

 

Hi,

 

I want to conditinally hide an inline vf page embedded in contact page layout.

 

Don't want to use sidebar javascripts.

 

Please advice.

Hello , 

 

 I am having one custome object Inventory.

 I am having two fields. ID and Name.

 

Now I have created one datatable which is having these two fields and one save button.

 

  I have created one dynamic trigger for updating record.

 I have created trigger for (before update) event.

 

Now what I want to get is: 

 

          I want to know the  unique record ID of updated record to fire the trigger.

    Please guide me as soon as possible

I keep getting the above error when I try to compile. I'm not sure if my placement of return values are off or not. Anyone see what I should be doing differently?

 

 

public List<Task> filterRecords(){
  	actList = new List<Task>();
  	
  	try {
  	actList = [
  	          SELECT Subject, WhatId, activityDate, status, priority, category__c, type__c, whoId
  	          FROM Task 
  	          WHERE activityDate=:act.ActivityDate AND status=:act.Status AND category__c=:act.category__c 
  	               AND type__c=:act.type__c AND priority=:act.Priority
  	          LIMIT 200
  	          ];
  	          
  	 if(actList.isEmpty()){
  	 	ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Could not find any records'));
  	 	return null;
  	 } 
  	 else if(!actList.isEmpty()){
  	 	return actList;
  	 } 
  	}
  	catch(Exception e){System.debug(e.getMessage());}
  }

 

  • August 25, 2013
  • Like
  • 0

Hi There,

 

I am having a URL which should auto populate the Account, Opportunity  and other object value called xxxxObject name on Case object.

 

below is the url 

 

/setup/ui/recordtypeselect.jsp?ent=Case&retURL=%2F{!Opportunity.AccountId}&save_new_url=%2F500%2Fe%3FretURL%3D%252F{!Opportunity.AccountId}%26def_account_id%3D{!Opportunity.AccountId}&CF00N30000009pICP={!Opportunity.Name}&CF00N30000009pICP_lkid={!Opportunity.Id}&CF00Ne0000000Wuu9={!Enrol_Event__c.Name}&CF00Ne0000000Wuu9_lkid={!Enrol_Event__c.Id}

 

It is populating Account,Opportunity but not EnrollmentEvent.

 

it works in dev box , but it is not working in Test environment , i am not understanding what's wrong with above url.

Please suggest me why I am unable to populate the enrollmenteventname.

Hi Friends,

 

I have been stuck in one issue where I'm creating a mergefield in a apex controller's property and displaying it on the page.

 

Below is the code for reference:

 

public with sharing class emailtempcls {
public string temps {get;set;}
public emailtempcls()
{
    temps='{!$user.username}';
}
}

 

<apex:page Controller="emailtempcls">
{!temps}
{!$User.Username}
</apex:page>

Actual  Output:  {!$user.username}   xyz@gmail.com

Desired Output :  xyz@gmail.com  xyz@gmail.com

How can i convert temps value as the mergefield value on page?

 

Can anyone please help me in converting merge field value dynamically. Is it possible? Any Suggestions would be really appreciated.

 

 

Thanks!

 

Hello,

 

I'm having problem deploying my new trigger from sandbox to production. When I attempt to deploy the trigger, I get an error message that says "Average all Apex class and trigger test coverage is 69%, at least 75% test coverage is required". How can I bypass this error for deploying the new trigger. Please advise.

 

Thanks

Paul

 

  • August 23, 2013
  • Like
  • 0

Hello,

 

I want to delete 500+ custom fields. Is there any solution to mass remove custom fields? I have tried with metadata Api using below code. But it gives me below error.

 

Object with id:04s900000037qo4AAA is InProgress
Error status code: INVALID_CROSS_REFERENCE_KEY
Error message: In field: members - no CustomField named Custom_Field__c found
Object with id:04s900000037qo4AAA is Error

 

Below is the code:

 


    public void deleteCustomField(String fullname) throws Exception
    {
        CustomField customField = new CustomField();
        customField.setFullName(fullname);
        
        UpdateMetadata updateMetadata = new UpdateMetadata();
        updateMetadata.setMetadata(customField);
        updateMetadata.setCurrentName(fullname);
        
        AsyncResult[] asyncResults  = metadataConnection.delete(new Metadata[] {customField});
 
        long waitTimeMilliSecs = ONE_SECOND;
 
        do
        {
            printAsyncResultStatus(asyncResults);
            waitTimeMilliSecs *= 2;
            Thread.sleep(waitTimeMilliSecs);
            asyncResults = metadataConnection.checkStatus(new String[]{asyncResults[0].getId()});
        } while (!asyncResults[0].isDone());
 
        printAsyncResultStatus(asyncResults);
    }

 


    private void printAsyncResultStatus(AsyncResult[] asyncResults) throws Exception {
        if (asyncResults == null || asyncResults.length == 0 || asyncResults[0] == null) {
            throw new Exception("The object status cannot be retrieved");
        }

        AsyncResult asyncResult = asyncResults[0]; //we are creating only 1 metadata object

        if (asyncResult.getStatusCode() != null) {
            System.out.println("Error status code: " +
                    asyncResult.getStatusCode());
            System.out.println("Error message: " + asyncResult.getMessage());
        }

        System.out.println("Object with id:" + asyncResult.getId() + " is " +
            asyncResult.getState());
    }

 

Is there any other solution (any app) to removing custom fields?

 

Thanks in advance,

 

Dhaval Panchal

Hi,

 

I want to convert datetime value

 

i.e. currently I am getting value "Mon Aug 26 11:49:39 GMT 2013" and I want to convert it to "26-Aug-13 11:49 PM"

 

Any Ideas?

 

I want to apply formatting on standard "CreatedDateTime" field.

Hello,

 

I want to delete 500+ custom fields. Is there any solution to mass remove custom fields? I have tried with metadata Api using below code. But it gives me below error.

 

Object with id:04s900000037qo4AAA is InProgress
Error status code: INVALID_CROSS_REFERENCE_KEY
Error message: In field: members - no CustomField named Custom_Field__c found
Object with id:04s900000037qo4AAA is Error

 

Below is the code:

 


    public void deleteCustomField(String fullname) throws Exception
    {
        CustomField customField = new CustomField();
        customField.setFullName(fullname);
        
        UpdateMetadata updateMetadata = new UpdateMetadata();
        updateMetadata.setMetadata(customField);
        updateMetadata.setCurrentName(fullname);
        
        AsyncResult[] asyncResults  = metadataConnection.delete(new Metadata[] {customField});
 
        long waitTimeMilliSecs = ONE_SECOND;
 
        do
        {
            printAsyncResultStatus(asyncResults);
            waitTimeMilliSecs *= 2;
            Thread.sleep(waitTimeMilliSecs);
            asyncResults = metadataConnection.checkStatus(new String[]{asyncResults[0].getId()});
        } while (!asyncResults[0].isDone());
 
        printAsyncResultStatus(asyncResults);
    }

 


    private void printAsyncResultStatus(AsyncResult[] asyncResults) throws Exception {
        if (asyncResults == null || asyncResults.length == 0 || asyncResults[0] == null) {
            throw new Exception("The object status cannot be retrieved");
        }

        AsyncResult asyncResult = asyncResults[0]; //we are creating only 1 metadata object

        if (asyncResult.getStatusCode() != null) {
            System.out.println("Error status code: " +
                    asyncResult.getStatusCode());
            System.out.println("Error message: " + asyncResult.getMessage());
        }

        System.out.println("Object with id:" + asyncResult.getId() + " is " +
            asyncResult.getState());
    }

 

Is there any other solution (any app) to removing custom fields?

 

Thanks in advance,

 

Dhaval Panchal