• KRK
  • NEWBIE
  • 25 Points
  • Member since 2011

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

I have an object called book. I want to make a custom button for the book__c object called sell. If the book has been sold(book__c.book_Status__c == 'Sold') a message will display saying that the book has been sold. otherwise the button will take you to another visualforce page called book sell. does anyone have any suggestions.

Hi Guys,

 

I have a requirement like this,

I have a custom field which is autogenerated no in contacts object.If i add task to particular contact than i have a

custom field in task object which should be updated with the custom field value of contact(auto generated no).

 

conclusion, auto generated no should be in my task object custom field.

 

I wrote a trigger called before insert.

 

trigger task_feild_update on Task (before insert)
{
    
    Contact con = new Contact();
            con = [select id,Name,Languages__c
                    from Contact
                    where id =: Trigger.new[0].Who.Id];
                    system.debug('*************'+con);

            Task t = new Task();
                t.CustomFeild__c = con.Languages__c;

}

 

but data is not updating can anybody tell me how to solve it.

It is very urgent.

 

Thanks In Advance,

Bujji

  • March 08, 2012
  • Like
  • 0

Hi,

 

After the go live of Spring 12 a lot of tests code failed in our Org and the error was always the same: to create an user, we

used the profile name 'Usuário Padrão' that failed to be retrieved from a Map.

 

I developed a small test class (testMap) that shows the error, testMethod01, and another that shows a workaround, testMethod02.

 

Could anyone confirm that it's a bug or if I'm doing something wrong?

 

Thanks in advance!

 

@isTest 
public class testMap {
@isTest 
public static void myTestMethod1() {
  Map<String,ID> profNameId= new Map<String,ID>();
  for (Profile prof : [select Id, Name from Profile where Name in ('Usuário padrão','Administrador Funcional')]) 
  { 
    profNameId.put(prof.Name , prof.Id); 
  }
  System.assert(profNameId.size() == 2, 'The map should have 2 elements'); 
  System.assert(profNameId.get('Administrador Funcional') <> null, 'The map for Administrador Funcional should not be null');
  System.assert(profNameId.get('Usuário padrão') <> null, 'The map for Usuário padrão should not be null'); 
}
@isTest 
public static void myTestMethod2() {
  Map<String,ID> profNameId= new Map<String,ID>();
  for (Profile prof : [select Id, Name from Profile where Name in ('Usuário padrão','Administrador Funcional')]) 
  { 
    if (prof.Name == 'Usuário padrão') { 
      profNameId.put('Usuario padrao', prof.Id); 
    } else { 
      profNameId.put(prof.Name , prof.Id); 
    } 
  }
  System.assert(profNameId.size() == 2, 'The map should have 2 elements'); 
  System.assert(profNameId.get('Administrador Funcional') <> null, 'The map for Administrador Funcional  should not be null');
  System.assert(profNameId.get('Usuario padrao') <> null, 'The map for Usuário padrão should not be null'); 
}
}

 

  • March 07, 2012
  • Like
  • 0

I have an object called book. I want to make a custom button for the book__c object called sell. If the book has been sold(book__c.book_Status__c == 'Sold') a message will display saying that the book has been sold. otherwise the button will take you to another visualforce page called book sell. does anyone have any suggestions.