• anyioneta1.3025054394678596E12
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 17
    Replies

I tried to use Site.com in my DE

but it brings out this message  ===> "You must be a Site.com publisher or contributor to access this page. Contact your administrator to enable the required permission."

 

So how do I enable the required permission to use Site.com in my DE???  

CASE

=====

I have developed a HR application for recruiting staff into my organization, I want applicants to apply for a manager position, but before applicants can have access to my site and apply for this position, they would have to be authenticated.

Hence I have assosiated a portal with my site to invite public users into an authenticated environment in order to track the personal information about all applicants that apply for this position. 

 

Note: once a user authenticates on my site, he automatically becomes a user with Applicant Manager Position Profile  (which is a clone of the Customer Portal Manager Profile)

 

CHALLENGE

===========
After I have considered qualifications of all the applicants that visited my site and applied for the Managers position in my org and make my selection based on the person that is most qualified fot the managers position.


I have to change the profile of the newly appointed manager from Applicant Manager Position Profile to MANAGER profile.

When I go to Setup -->Administration Setup --> Manager Users --> Users

I Click Edit on that particular User, I observe that the profile field does not giving me the option of changine the profile from the Applicant Manager Position Profile to MANAGER Profile.



Pls who can advise me on how to go about this???

I have developed a HR application for recruiting staff into my organization, I want applicants to apply for a manager position, but before applicants can have access to my site and apply for this position, they would have to be authenticated.

 

Hence I have assosiated a portal with my site to invite public users into an authenticated environment in order to track the personal information about all applicants that apply for this position.

 

The challenge is that after we consider their qualifications and make our selection on who has been appointed the Manager Position.

 

we have to change the profile of the newly appointed manager from the Applicant Manager Position Profile (a clone of the Customer Portal Manager Custom Profile)  to a MANAGER profile.

 

When I go to Setup -->Administration Setup --> Manager Users --> Users -->Click on Edit (on that particular User)

I notice that the profile field is not giving me the option of changine the profile from the Applicant Manager Position Profile to MANAGER Profile.

 

Pls who can advise me on how to go about this???

 

THIS IS WHAT I HAVE:

Object:  Stock

Record Id

Qty  Left

Qty Sold

Scanned Time

a06U0000004prYr

12

10

12-19-2011 5:33 AM

a06U0000000vSM3

42

20

12-19-2011 5:32 AM

a06U0000000vSLy

50

8

12-19-2011 5:31 AM

a06U0000000vSLt

60

10

12-19-2011 5:30 AM

 

Assuming that after stock keeper has entered some records; he discovers that he erroneously entered an incorrect Qty Sold for record three (which reads 8 instead of 5) and he decides to update.

 

WHAT I WANT TO ACHIEVE:

A bulk Trigger to update the two Later (Upper) records immediately after stock keeper updates Qty Sold for record three from 8 to 5.

Logic: add the difference b/w the Old Qty Sold and New Qty Sold (i.e. 8 - 5 = 3) to the Qty Left of the two Later  (Upper) records.

This will display the accurate information about the stock table as shown below:

 

Record Id

Qty  Left

Qty Sold

Scanned Time

a06U0000004prYr

15

10

12-19-2011 5:33 AM

a06U0000000vSM3

45

20

12-19-2011 5:32 AM

a06U0000000vSLy

50

5

12-19-2011 5:31 AM

a06U0000000vSLt

60

10

12-19-2011 5:30 AM

 

 

TRIGGER CODE:

trigger stockKeeping on Stock__c (after Update) {
    
    Map<String, Stock__c> stockMap = new Map<String, Stock__c>();
   
    Decimal val = 0;
    String oldName = '';


    for(Stock__c stock: System.Trigger.new) {

        oldName = System.Trigger.oldMap.get(stock.Id).Name;

        if(stock.Name == oldName){
            val = stock.Qty_Sold__c - System.Trigger.oldMap.get(stock.Id).Qty_Sold__c;
            stockMap.put(stock.Name, stock);
        }
    }
    
    List<Stock__c> listStock = [SELECT Id, Name, Stock__c, Qty_Sold__c, Date__c FROM Stock__c WHERE Name NOT IN     :stockMap.KeySet() ORDER BY Date__c DESC];
    
    for (Stock__c stock: listStock) {
       
       if(ock.Date__c > stockMap.get(oldName).Date__c ) {
            stock.Stock__c += val;            
       }                    
    }
    
    update listStock;        //line 25, column 5
}

 

 

ERROR: 

Invalid Data.
stockKeeping: execution of AfterUpdate caused by: System.DmlException: Update failed.
First exception on row 0 with id a06U0000004prYrIAI; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, stockKeeping: maximum trigger depth exceeded Stock trigger event AfterUpdate for [a06U0000000vSLy] Stock trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr] Stock trigger event AfterUpdate for [a06U0000000vSLy] Test trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr] Stock trigger event AfterUpdate for [a06U0000000vSLy] Stock trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr] Stock trigger event AfterUpdate for [a06U0000000vSLy] Stock trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr] Stock trigger event AfterUpdate for [a06U0000000vSLy] Stock trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr] Stock trigger event AfterUpdate for [a06U0000000vSLy] Stock trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr] Stock trigger event AfterUpdate for [a06U0000000vSLy] Stock trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr] Stock trigger event AfterUpdate for [a06U0000000vSLy] Stock trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr]: []: Trigger.stockKeeping: line 25, column 5


Please can somebody help!!.


Thanks.

 

Is it possible to configure authentication in my public site such that Users in my org will have access to my public site based on their level of privileges.

e.g. a user with the CEO Role and Admin Profile should be able to have access to a HR application ether by logging in through https://login.salesforce.com/ or by logging in through my public site https://anyioneta.force.com
 




How can I perform actions like onBlur, onFocus, onClick on some fields in my Salesforce Edit Page.

 

Pls with examples if possible.

A trigger that executed when updating a record,

It update all the other records in the database that have dates greater than the actual record bean updated in descending order.

 

 

I need help Pls!!!

 

 

=========================================CLARIFY=============================================

 

SALES TABLE

 

Action

Date

Supplies

Stock

Qty Sold

Bal Stock

Sold Price

Total Price

Customer

Edit |Del

11/21/2011 2:57 PM

60

67

14

53

$990.00

$13860.00

Oka

Edit |Del

11/21/2011 2:54 PM

0

10

3

7

$1000.00

$3000.00

Woko

Edit |Del

11/21/2011 2:52 PM

0

35

25

10

$980.00

$24500.00

Jude

Edit |Del

11/21/2011 2:51 PM

0

45

10

35

$1000.00

$10000.00

Mike

Edit |Del

11/21/2011 2:50 PM

100

100

55

45

$920.00

$50600.00

Paul

 

 

WHAT I WANT TO ACHIEVE

 

If Stock Keeper updates Oty Sold in Row three from 25 to 23

I want both Stock and Bal Stock of Row Two then Row One be updated in that order

after Row Three has updated.

 

 

Action

Date

Supplies

Stock

Qty Sold

Bal Stock

Sold Price

Total Price

Customer

Edit |Del

11/21/2011 2:57 PM

60

69

14

55

$990.00

$13860.00

Oka

Edit |Del

11/21/2011 2:54 PM

0

12

3

9

$1000.00

$3000.00

Woko

Edit |Del

11/21/2011 2:52 PM

0

35

23

12

$980.00

$24500.00

Jude

Edit |Del

11/21/2011 2:51 PM

0

45

10

35

$1000.00

$10000.00

Mike

Edit |Del

11/21/2011 2:50 PM

100

100

55

45

$920.00

$50600.00

Paul

 

NOTE: A separate before update  trigger is already handling the update of Bal Stock in Row three from 10 to 12

 

 

 

 

MY CODE

 

trigger stockKeepingUpdate on Sales__c (before update) {

List<Sales__c> sales = [SELECT Id, Name, Supplies__c, Stock__c, Qty_Sold__c, Bal_Stock__c, Sold_Price__c,   Total_Price__c, Date__c  FROM Sales__c ORDER BY Date__c DESC];
                            
    for(Sales__c s1:System.Trigger.new){
        for(Sales__c s2: sales){
            Integer val = 0;
            
            if(s1.Date__c == s2.Date__c){
                val = Integer.valueOf(s2.Qty_Sold__c - s1.Qty_Sold__c);      // 12 - 10 = 2
            }
            
            if(s1.Date__c > s2.Date__c){                
                s2.Stock__c = s2.Stock__c + val;                    //  (1st pass) 10 + 2 = 12     (2nd pass) 67 + 2 = 69
                s2.Bal_Stock__c = s2.Bal_Stock__c + val;   //  (1st pass) 7 + 2 = 8         (2nd pass)  53 + 2 = 55
            }
        }
    }
    
    update sales;  //line 21, column 5
}

 

 

ERROR MSG

 

System.DmlException: Update failed. First exception on row 2 with id a02U0000001K0TJIA0; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = a02U0000001K0TJ) is currently in trigger stockKeepingUpdate, therefore it cannot recursively update itself: []: Trigger.stockKeepingUpdate: line 21, column 5

 

I registered for 30 days free trial of the Unlimited Edition. I created a ptofile called LECTURER but when I created a New user. This user only has a User Lisence of  Salseforce Platform & Chatter Free BUT it does not have Salesforce User Lisence which will allow me select the LECTURER Profile for my new User. Why will the 30 days trial not give me the Salesforce User Lisence so that I can change the profile of my new User to LECTURER???

ERROR MESSAGE:

System.QueryException: Didn't understand relationship 'Department__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.: Trigger.UpdateAllocate: line 3, column 43

 

 

f(Trigger.isInsert){


        String queryString = 'SELECT Id, Name, Title__c, Last_Name__c, Middle_Name__c, First_Name__c, Rank__c,    Gender__c, Email__c, Mobile_Number__c, (SELECT Id, Name, Description__c from Department__r LIMIT 1) from Lecturer__c';


            SObject[] queryParentObject = Database.query(queryString);
                    
            for (SObject parentRecord : queryParentObject){
                Object ParentFieldValue1 = parentRecord.get('Name');
                Object ParentFieldValue2 = parentRecord.get('Last_Name__c');
                Object ParentFieldValue3 = parentRecord.get('Last_Name__c');
                Object ParentFieldValue4 = parentRecord.get('Middle_Name__c');
                Object ParentFieldValue5 = parentRecord.get('First_Name__c');
                Object ParentFieldValue6 = parentRecord.get('Rank__c');
                Object ParentFieldValue7 = parentRecord.get('Gender__c');
                Object ParentFieldValue8 = parentRecord.get('Email__c');
                Object ParentFieldValue9 = parentRecord.get('Mobile_Number__c');
                // Prevent a null relationship from being accessed 
                Object ChildFieldValue1;
                Object ChildFieldValue2;
                SObject[] childRecordsFromParent = parentRecord.getSObjects('Department__c');
                if (childRecordsFromParent != null) {
                    for (SObject childRecord : childRecordsFromParent){
                        ChildFieldValue1 = childRecord.get('Name');
                        ChildFieldValue2 = childRecord.get('Description__c');
                        //System.debug('Account Name: ' + ParentFieldValue + '. Contact Name: '+ ChildFieldValue1 + ' ' + ChildFieldValue2);
                    }
                }
               
                Object mName = ParentFieldValue4;          
                if(mName  == null){
                   mName ='';
                }
               
                allocateList.add(new Allocate__c(
                Name = String.valueOf(ParentFieldValue1),
                Full_Name__c = ParentFieldValue2+' '+ParentFieldValue3+' '+mName+' '+ParentFieldValue5,
                Rank__c = String.valueOf(ParentFieldValue6),
                Gender__c = String.valueOf(ParentFieldValue7),
                Email__c = String.valueOf(ParentFieldValue8),
                Mobile_Number__c = String.valueOf(ParentFieldValue9),
                Department__c = String.valueOf(ChildFieldValue1),
                School__c = String.valueOf(ChildFieldValue2)));
                             
            }
            insert allocateList;
      }

 

 



 

Can Sombody Help?

How do I convert Objects to String.
e.g.
Object ChildFieldValue = ChildRecord.get('FirstName);
string s = ChildFieldValue1 .toString();


Error: Compile Error: Illegal assignment from Object to String at line 51 column 17


List<Course_Allocation__c> allocateList = new List<Course_Allocation__c>() ;

for(Lecturer__c lec: Trigger.new){                        
                myList.add(new Course_Allocation__c(Name = lec.Name, Full_Name__c = lec.Last_Name__c,
                Email__c = lec.Email__c, Mobile_Number__c = lec.Mobile_Number__c,
                Department__c = lec.Department__r.Name));
 }


But after insertion Department__c field is empty, why?


--------------------
|OBJECT_1    |
|------------------|
|First Name    |
|------------------|
|Last Name    |
|------------------|

 -------------------
|OBJECT_2    |
|------------------|
|First Name    |
|------------------|
|Last Name    |
|------------------|

How do i automatically enter the same values in First Name and Last Name  fields of OBJECT_2 , as soon as a user enters values in First Name and Last Name fields of OBJECT_1?


I know i can achieve it using triggers but do not know how to go about it?


Thanks.

 

 

Thanks nkit Arora , your Trigger Code was very helpfull in geting me started about writting triggers. But I still need the fields in Object2 to update automatically as soon as i update the fields in Object2.

How do I achieve this?



Just wondering if siteforce/site.com  free for developers just like force.com.

I would like to be able to practise/develop  custom modules and was wondering which is a good place to start with.

Also wonderging if there is something like a HelloWorld module which will show us step by step how to build modules in Siteforce. Any help/input will be appreciated.

Thanks

N

THIS IS WHAT I HAVE:

Object:  Stock

Record Id

Qty  Left

Qty Sold

Scanned Time

a06U0000004prYr

12

10

12-19-2011 5:33 AM

a06U0000000vSM3

42

20

12-19-2011 5:32 AM

a06U0000000vSLy

50

8

12-19-2011 5:31 AM

a06U0000000vSLt

60

10

12-19-2011 5:30 AM

 

Assuming that after stock keeper has entered some records; he discovers that he erroneously entered an incorrect Qty Sold for record three (which reads 8 instead of 5) and he decides to update.

 

WHAT I WANT TO ACHIEVE:

A bulk Trigger to update the two Later (Upper) records immediately after stock keeper updates Qty Sold for record three from 8 to 5.

Logic: add the difference b/w the Old Qty Sold and New Qty Sold (i.e. 8 - 5 = 3) to the Qty Left of the two Later  (Upper) records.

This will display the accurate information about the stock table as shown below:

 

Record Id

Qty  Left

Qty Sold

Scanned Time

a06U0000004prYr

15

10

12-19-2011 5:33 AM

a06U0000000vSM3

45

20

12-19-2011 5:32 AM

a06U0000000vSLy

50

5

12-19-2011 5:31 AM

a06U0000000vSLt

60

10

12-19-2011 5:30 AM

 

 

TRIGGER CODE:

trigger stockKeeping on Stock__c (after Update) {
    
    Map<String, Stock__c> stockMap = new Map<String, Stock__c>();
   
    Decimal val = 0;
    String oldName = '';


    for(Stock__c stock: System.Trigger.new) {

        oldName = System.Trigger.oldMap.get(stock.Id).Name;

        if(stock.Name == oldName){
            val = stock.Qty_Sold__c - System.Trigger.oldMap.get(stock.Id).Qty_Sold__c;
            stockMap.put(stock.Name, stock);
        }
    }
    
    List<Stock__c> listStock = [SELECT Id, Name, Stock__c, Qty_Sold__c, Date__c FROM Stock__c WHERE Name NOT IN     :stockMap.KeySet() ORDER BY Date__c DESC];
    
    for (Stock__c stock: listStock) {
       
       if(ock.Date__c > stockMap.get(oldName).Date__c ) {
            stock.Stock__c += val;            
       }                    
    }
    
    update listStock;        //line 25, column 5
}

 

 

ERROR: 

Invalid Data.
stockKeeping: execution of AfterUpdate caused by: System.DmlException: Update failed.
First exception on row 0 with id a06U0000004prYrIAI; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, stockKeeping: maximum trigger depth exceeded Stock trigger event AfterUpdate for [a06U0000000vSLy] Stock trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr] Stock trigger event AfterUpdate for [a06U0000000vSLy] Test trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr] Stock trigger event AfterUpdate for [a06U0000000vSLy] Stock trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr] Stock trigger event AfterUpdate for [a06U0000000vSLy] Stock trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr] Stock trigger event AfterUpdate for [a06U0000000vSLy] Stock trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr] Stock trigger event AfterUpdate for [a06U0000000vSLy] Stock trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr] Stock trigger event AfterUpdate for [a06U0000000vSLy] Stock trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr] Stock trigger event AfterUpdate for [a06U0000000vSLy] Stock trigger event AfterUpdate for [a06U0000000vSLt, a06U0000000vSM3, a06U0000004prYr]: []: Trigger.stockKeeping: line 25, column 5


Please can somebody help!!.


Thanks.

 

How can I perform actions like onBlur, onFocus, onClick on some fields in my Salesforce Edit Page.

 

Pls with examples if possible.

Hi all,

 

Q) How to handle the exception in Trigger?

 

Please give answer with Example..

 

Thanks for u r help......

I need to query an object called trans__c which has the following fields

 

id,

scantime__c // datetime

name

asset__c // external id

status

 

I need to get only data which has status as pending and if there are any repeating asset then i need to get only  record with scantime as the latest.

 

Thanks

 

 

 

  • December 17, 2011
  • Like
  • 0

A trigger that executed when updating a record,

It update all the other records in the database that have dates greater than the actual record bean updated in descending order.

 

 

I need help Pls!!!

 

 

=========================================CLARIFY=============================================

 

SALES TABLE

 

Action

Date

Supplies

Stock

Qty Sold

Bal Stock

Sold Price

Total Price

Customer

Edit |Del

11/21/2011 2:57 PM

60

67

14

53

$990.00

$13860.00

Oka

Edit |Del

11/21/2011 2:54 PM

0

10

3

7

$1000.00

$3000.00

Woko

Edit |Del

11/21/2011 2:52 PM

0

35

25

10

$980.00

$24500.00

Jude

Edit |Del

11/21/2011 2:51 PM

0

45

10

35

$1000.00

$10000.00

Mike

Edit |Del

11/21/2011 2:50 PM

100

100

55

45

$920.00

$50600.00

Paul

 

 

WHAT I WANT TO ACHIEVE

 

If Stock Keeper updates Oty Sold in Row three from 25 to 23

I want both Stock and Bal Stock of Row Two then Row One be updated in that order

after Row Three has updated.

 

 

Action

Date

Supplies

Stock

Qty Sold

Bal Stock

Sold Price

Total Price

Customer

Edit |Del

11/21/2011 2:57 PM

60

69

14

55

$990.00

$13860.00

Oka

Edit |Del

11/21/2011 2:54 PM

0

12

3

9

$1000.00

$3000.00

Woko

Edit |Del

11/21/2011 2:52 PM

0

35

23

12

$980.00

$24500.00

Jude

Edit |Del

11/21/2011 2:51 PM

0

45

10

35

$1000.00

$10000.00

Mike

Edit |Del

11/21/2011 2:50 PM

100

100

55

45

$920.00

$50600.00

Paul

 

NOTE: A separate before update  trigger is already handling the update of Bal Stock in Row three from 10 to 12

 

 

 

 

MY CODE

 

trigger stockKeepingUpdate on Sales__c (before update) {

List<Sales__c> sales = [SELECT Id, Name, Supplies__c, Stock__c, Qty_Sold__c, Bal_Stock__c, Sold_Price__c,   Total_Price__c, Date__c  FROM Sales__c ORDER BY Date__c DESC];
                            
    for(Sales__c s1:System.Trigger.new){
        for(Sales__c s2: sales){
            Integer val = 0;
            
            if(s1.Date__c == s2.Date__c){
                val = Integer.valueOf(s2.Qty_Sold__c - s1.Qty_Sold__c);      // 12 - 10 = 2
            }
            
            if(s1.Date__c > s2.Date__c){                
                s2.Stock__c = s2.Stock__c + val;                    //  (1st pass) 10 + 2 = 12     (2nd pass) 67 + 2 = 69
                s2.Bal_Stock__c = s2.Bal_Stock__c + val;   //  (1st pass) 7 + 2 = 8         (2nd pass)  53 + 2 = 55
            }
        }
    }
    
    update sales;  //line 21, column 5
}

 

 

ERROR MSG

 

System.DmlException: Update failed. First exception on row 2 with id a02U0000001K0TJIA0; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = a02U0000001K0TJ) is currently in trigger stockKeepingUpdate, therefore it cannot recursively update itself: []: Trigger.stockKeepingUpdate: line 21, column 5

 

ERROR MESSAGE:

System.QueryException: Didn't understand relationship 'Department__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.: Trigger.UpdateAllocate: line 3, column 43

 

 

f(Trigger.isInsert){


        String queryString = 'SELECT Id, Name, Title__c, Last_Name__c, Middle_Name__c, First_Name__c, Rank__c,    Gender__c, Email__c, Mobile_Number__c, (SELECT Id, Name, Description__c from Department__r LIMIT 1) from Lecturer__c';


            SObject[] queryParentObject = Database.query(queryString);
                    
            for (SObject parentRecord : queryParentObject){
                Object ParentFieldValue1 = parentRecord.get('Name');
                Object ParentFieldValue2 = parentRecord.get('Last_Name__c');
                Object ParentFieldValue3 = parentRecord.get('Last_Name__c');
                Object ParentFieldValue4 = parentRecord.get('Middle_Name__c');
                Object ParentFieldValue5 = parentRecord.get('First_Name__c');
                Object ParentFieldValue6 = parentRecord.get('Rank__c');
                Object ParentFieldValue7 = parentRecord.get('Gender__c');
                Object ParentFieldValue8 = parentRecord.get('Email__c');
                Object ParentFieldValue9 = parentRecord.get('Mobile_Number__c');
                // Prevent a null relationship from being accessed 
                Object ChildFieldValue1;
                Object ChildFieldValue2;
                SObject[] childRecordsFromParent = parentRecord.getSObjects('Department__c');
                if (childRecordsFromParent != null) {
                    for (SObject childRecord : childRecordsFromParent){
                        ChildFieldValue1 = childRecord.get('Name');
                        ChildFieldValue2 = childRecord.get('Description__c');
                        //System.debug('Account Name: ' + ParentFieldValue + '. Contact Name: '+ ChildFieldValue1 + ' ' + ChildFieldValue2);
                    }
                }
               
                Object mName = ParentFieldValue4;          
                if(mName  == null){
                   mName ='';
                }
               
                allocateList.add(new Allocate__c(
                Name = String.valueOf(ParentFieldValue1),
                Full_Name__c = ParentFieldValue2+' '+ParentFieldValue3+' '+mName+' '+ParentFieldValue5,
                Rank__c = String.valueOf(ParentFieldValue6),
                Gender__c = String.valueOf(ParentFieldValue7),
                Email__c = String.valueOf(ParentFieldValue8),
                Mobile_Number__c = String.valueOf(ParentFieldValue9),
                Department__c = String.valueOf(ChildFieldValue1),
                School__c = String.valueOf(ChildFieldValue2)));
                             
            }
            insert allocateList;
      }

 

 



 

Can Sombody Help?

List<Course_Allocation__c> allocateList = new List<Course_Allocation__c>() ;

for(Lecturer__c lec: Trigger.new){                        
                myList.add(new Course_Allocation__c(Name = lec.Name, Full_Name__c = lec.Last_Name__c,
                Email__c = lec.Email__c, Mobile_Number__c = lec.Mobile_Number__c,
                Department__c = lec.Department__r.Name));
 }


But after insertion Department__c field is empty, why?


--------------------
|OBJECT_1    |
|------------------|
|First Name    |
|------------------|
|Last Name    |
|------------------|

 -------------------
|OBJECT_2    |
|------------------|
|First Name    |
|------------------|
|Last Name    |
|------------------|

How do i automatically enter the same values in First Name and Last Name  fields of OBJECT_2 , as soon as a user enters values in First Name and Last Name fields of OBJECT_1?


I know i can achieve it using triggers but do not know how to go about it?


Thanks.

 

 

Thanks nkit Arora , your Trigger Code was very helpfull in geting me started about writting triggers. But I still need the fields in Object2 to update automatically as soon as i update the fields in Object2.

How do I achieve this?