• RAJNag
  • NEWBIE
  • 40 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 21
    Questions
  • 23
    Replies
Hi All,
My requirement is whenever click on the button the pagesource code display with in the page but it's navigate ti another page how can i display code in same page , plz help me

<apex:page sidebar="false">
 
   <html>
    <head>
    </head>
    
    <body>
    
    <div style="border:1px solid pink;padding:20px;font-size:20px">
        <input type="text" name="v"><br></br>
        <input type="button" value="Click Here" onclick="msg()"/>
        </input>  
    </div>
    
   <script type="text/javascript">  
    function msg(){  
    //var url= prompt("Enter the URL :","");  
    var sValue = document.getElementsByName("v")[0].value;
    //document.write(sValue);
    //alert("I am "+sValue);
   // window.open(sValue);
    location.href = sValue;
    open(sValue);
    //window.location.assign(sValue);
      parent.location= document.getElementsByName("sValue")[0].sValue;
    //window.document(sValue);
    
    //window.location="sValue";
 
     }  
    </script>  
    <body onload="javascript: msg()"></body>
    <div style="border:1px solid pink;padding:20px;font-size:20px">
        <p><a href="sValue">Visit our HTML tutorial</a></p>
        u can try here u need to get the Page view source code
    
    </div>
    </body>
    </html>
    <html>
    <head>
    <title>SOAP JavaScript Client Test</title>
    <script type="text/javascript">
        function soap() {
            var xmlhttp = new XMLHttpRequest();
            xmlhttp.open('POST', 'http://www.webservicex.com/globalweather.asmx?wsdlm', true);

            // build SOAP request
            var sr =
                '<?xml version="1.0" encoding="utf-8"?>' +
                '<soapenv:Envelope ' +
                    'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
                    'xmlns:api="http://127.0.0.1/Integrics/Enswitch/API" ' +
                    'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' +
                    'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">' +
                    '<soapenv:Body>' +
                        '<api:some_api_call soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">' +
                            '<username xsi:type="xsd:string">login_username</username>' +
                            '<password xsi:type="xsd:string">password</password>' +
                        '</api:some_api_call>' +
                    '</soapenv:Body>' +
                '</soapenv:Envelope>';

            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState == 4) {
                    if (xmlhttp.status == 200) {

                        alert('done use firebug to see response');
                    }
                }
            }
            // Send the POST request
            xmlhttp.setRequestHeader('Content-Type', 'text/xml');
            xmlhttp.send(sr);
            // send request
            // ...
        }
    </script>
</head>
<body>
    <form name="Demo" action="" method="post">
        <div>
            <input type="button" value="Soap" onclick="soap();" />
            window.parent.location.href="soap()";
        </div>
    </form>
</body>
</html> 
</apex:page>


Thanks
Raj

 
  • August 10, 2015
  • Like
  • 0
How to insert multiple remote site settings through apex class.please sare the sample code plz--------------------


Regards
Raj
Hi All

I need one urgent requirement, In visualforce page i have one text box and Command Button whenever user entered any endpoint url in text box and click on command button it will generate some soap(parse) request output.Please send me anyone sample code on this requirement.Otherwise give me some ideas please it's urgent requirement.How can i achive this.


Thanks in Advance
Raj.
Hi

i need java to salesforce rest api integration step by step .please any one share the sample code please.


Thanks
Raj
Hi all
I wrote one soap class in a perticlur endpoint url (wsdl Class).I need dynamically means i will give any endpoind url to apex class it will through soap request output. plz need dyanamically

/Generated by wsdl2apex

public class GlobalWhetherClass {
    public class GetWeather_element {
        public String CityName;
        public String CountryName;
        private String[] CityName_type_info = new String[]{'CityName','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] CountryName_type_info = new String[]{'CountryName','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'CityName','CountryName'};
    }
    public class GetCitiesByCountry_element {
        public String CountryName;
        private String[] CountryName_type_info = new String[]{'CountryName','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'CountryName'};
    }
    public class GetWeatherResponse_element {
        public String GetWeatherResult;
        private String[] GetWeatherResult_type_info = new String[]{'GetWeatherResult','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'GetWeatherResult'};
    }
    public class GetCitiesByCountryResponse_element {
        public String GetCitiesByCountryResult;
        private String[] GetCitiesByCountryResult_type_info = new String[]{'GetCitiesByCountryResult','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'GetCitiesByCountryResult'};
    }
    public class GlobalWeatherSoap {
        public String endpoint_x = 'http://www.webservicex.com/globalweather.asmx';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://www.webserviceX.NET', 'GlobalWhetherClass'};
        public String GetCitiesByCountry(String CountryName) {
            GlobalWhetherClass.GetCitiesByCountry_element request_x = new GlobalWhetherClass.GetCitiesByCountry_element();
            request_x.CountryName = CountryName;
            GlobalWhetherClass.GetCitiesByCountryResponse_element response_x;
            Map<String, GlobalWhetherClass.GetCitiesByCountryResponse_element> response_map_x = new Map<String, GlobalWhetherClass.GetCitiesByCountryResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.webserviceX.NET/GetCitiesByCountry',
              'http://www.webserviceX.NET',
              'GetCitiesByCountry',
              'http://www.webserviceX.NET',
              'GetCitiesByCountryResponse',
              'GlobalWhetherClass.GetCitiesByCountryResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.GetCitiesByCountryResult;
        }
        public String GetWeather(String CityName,String CountryName) {
            GlobalWhetherClass.GetWeather_element request_x = new GlobalWhetherClass.GetWeather_element();
            request_x.CityName = CityName;
            request_x.CountryName = CountryName;
            GlobalWhetherClass.GetWeatherResponse_element response_x;
            Map<String, GlobalWhetherClass.GetWeatherResponse_element> response_map_x = new Map<String, GlobalWhetherClass.GetWeatherResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.webserviceX.NET/GetWeather',
              'http://www.webserviceX.NET',
              'GetWeather',
              'http://www.webserviceX.NET',
              'GetWeatherResponse',
              'GlobalWhetherClass.GetWeatherResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.GetWeatherResult;
        }
    }
}

Thanks In advance
Raj.
Hi

I wrote One soap class i checked developer consloe its displyed country and state values .

//Generated by wsdl2apex

public class GlobalWhetherClass {
    public class GetWeather_element {
        public String CityName;
        public String CountryName;
        private String[] CityName_type_info = new String[]{'CityName','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] CountryName_type_info = new String[]{'CountryName','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'CityName','CountryName'};
    }
    public class GetCitiesByCountry_element {
        public String CountryName;
        private String[] CountryName_type_info = new String[]{'CountryName','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'CountryName'};
    }
    public class GetWeatherResponse_element {
        public String GetWeatherResult;
        private String[] GetWeatherResult_type_info = new String[]{'GetWeatherResult','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'GetWeatherResult'};
    }
    public class GetCitiesByCountryResponse_element {
        public String GetCitiesByCountryResult;
        private String[] GetCitiesByCountryResult_type_info = new String[]{'GetCitiesByCountryResult','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'GetCitiesByCountryResult'};
    }
    public class GlobalWeatherSoap {
        public String endpoint_x = 'http://www.webservicex.com/globalweather.asmx';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://www.webserviceX.NET', 'GlobalWhetherClass'};
        public String GetCitiesByCountry(String CountryName) {
            GlobalWhetherClass.GetCitiesByCountry_element request_x = new GlobalWhetherClass.GetCitiesByCountry_element();
            request_x.CountryName = CountryName;
            GlobalWhetherClass.GetCitiesByCountryResponse_element response_x;
            Map<String, GlobalWhetherClass.GetCitiesByCountryResponse_element> response_map_x = new Map<String, GlobalWhetherClass.GetCitiesByCountryResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.webserviceX.NET/GetCitiesByCountry',
              'http://www.webserviceX.NET',
              'GetCitiesByCountry',
              'http://www.webserviceX.NET',
              'GetCitiesByCountryResponse',
              'GlobalWhetherClass.GetCitiesByCountryResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.GetCitiesByCountryResult;
        }
        public String GetWeather(String CityName,String CountryName) {
            GlobalWhetherClass.GetWeather_element request_x = new GlobalWhetherClass.GetWeather_element();
            request_x.CityName = CityName;
            request_x.CountryName = CountryName;
            GlobalWhetherClass.GetWeatherResponse_element response_x;
            Map<String, GlobalWhetherClass.GetWeatherResponse_element> response_map_x = new Map<String, GlobalWhetherClass.GetWeatherResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.webserviceX.NET/GetWeather',
              'http://www.webserviceX.NET',
              'GetWeather',
              'http://www.webserviceX.NET',
              'GetWeatherResponse',
              'GlobalWhetherClass.GetWeatherResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.GetWeatherResult;
        }
    }
}

but new requirement is whenever select the country then display the state values in visualforce page .

Thanks in advance
Raj
Hi everyone

Can you please tell how to lean step by step integration in salesforce .

Regards
Raj

 
Hi

Create VF page and controller,If I will give MADRAS and INDIA ,need some output in UI,

Output
Display the Table format like   left column  display label and right column display temparatue.How can i achive this please send sample code anyone.

Regards
Raj
Hi

i am having custom object,now i am displaying records in list view as well as detail view,so i want to add new button on record list view and edit, save buttons on detail view in salesforce1. This records  detail view designed with visuvalforce pages.


Thanks for Advance
Raj
Hi 

Can u plz any one send me Sample code for Trigger Context Variable


Thanks for Advance
Raj
Hi

@isTest 
public class BatchDeleteEndUserTest 
{
    static testMethod void TestBatchDeleteEndUser() 
    {
        
        // Create End User data here, please update that as per your object and fields
        EndUser__c objEndUser = new EndUser__c();
        objEndUser.Name = 'Test End User';
        Insert objEndUser;
        
         batchDeleteEndUser obj = new batchDeleteEndUser();   
         String chron = '0 0 23 * * ?';        
         String jobid = System.schedule('testScheduledApex', chron, obj);
         CronTrigger ct = [Select id , CronExpression from CronTrigger where id = :jobId];
         System.assertEquals(chron,ct.CronExpression); 
    }
}


Class
global class batchDeleteEndUser implements Schedulable
{
    
    public static String CRON_EXP = '0 0 12 1 1/3 ? *';
 
    
    global static String scheduleIt() {
        batchDeleteEndUser delbatch = new batchDeleteEndUser();
        return System.schedule('Delete EndUser Batch', CRON_EXP, delbatch);
        } 
    
 
    
    global void execute(SchedulableContext sc) {
        
        Datetime days = system.now().addDays(-365);
        
       List<EndUser__c> objectList = new List<EndUser__c>();
         
        for (EndUser__c EUser: [
            select Id,name
            from EndUser__c
            where Id not in (select End_User__c from Case where status != 'Closed') and ((Time_of_Last_Created_Case__c<= :days and Time_of_Last_Initiated_Chat__c<=:days ) or (Time_of_Last_Created_Case__c=null and Time_of_Last_Initiated_Chat__c<=:days) or (Time_of_Last_Created_Case__c<= :days and Time_of_Last_Initiated_Chat__c=null))
        ]) {
            objectList.add(EUser);
           
        }
       
 
        if (!objectList.isEmpty()) {
           delete objectList;
           system.debug('enduser----'+objectList);
        }
  }  
}


Regards 

Raj

 
Hi 

global class batchDeleteEndUser implements Schedulable
{
    
    public static String CRON_EXP = '0 0 12 1 1/3 ? *';
 
    
    global static String scheduleIt() {
        batchDeleteEndUser delbatch = new batchDeleteEndUser();
        return System.schedule('Delete EndUser Batch', CRON_EXP, delbatch);
        } 
    
 
    
    global void execute(SchedulableContext sc) {
        
        Datetime days = system.now().addDays(-365);
        
       List<EndUser__c> objectList = new List<EndUser__c>();
         
        for (EndUser__c EUser: [
            select Id,name
            from EndUser__c
            where Id not in (select End_User__c from Case where status != 'Closed') and ((Time_of_Last_Created_Case__c<= :days and Time_of_Last_Initiated_Chat__c<=:days ) or (Time_of_Last_Created_Case__c=null and Time_of_Last_Initiated_Chat__c<=:days) or (Time_of_Last_Created_Case__c<= :days and Time_of_Last_Initiated_Chat__c=null))
        ]) {
            objectList.add(EUser);
           
        }
       
 
        if (!objectList.isEmpty()) {
           delete objectList;
           system.debug('enduser----'+objectList);
        }
  }  
}


Hi any one write the test class for above class its very urgent please---------------------

Thanks for Advance

Raj
Hi 

through vf page u will get one mail along with password in @mail there is link...
when u click on the link its ask enter password,
if u entered 3 times wrong password,it will through error ,  how can i achive this one through vf page plz anyone send me code 

Thanks in advance its needful very urgent.
Hi 

through vf page u will get one mail along with password in @mail there is link...
when u click on the link its ask enter password,
if u entered 3 times wrong password,it will through error ,  how can i achive this one through vf page plz anyone send me code 

Thanks in advance its needful very urgent 
hi

How to learn salesforce intigration fastly
can u plz anyone send me links step by step procedure in integrations.


thanks
Nagaraju.
Hi 
I am having four fields like  
nagaraju__Num1__c
nagaraju__Num2__c

nagaraju__Number1__c
nagaraju__Number2__c
whenever these two fields nagaraju__Num1__c,nagaraju__Num2__c equal to null remaing two fields are sum and update the formula field .

I wrote this condition but in that formula true conditon not working only false conditon working let me know the what i mistake plz 

IF((nagaraju__Num1__c == null && nagaraju__Num2__c == null),nagaraju__Number1__c + nagaraju__Number2__c,nagaraju__Num1__c + nagaraju__Num2__c)

thanks 
Raj
I mean which field i will take for reference to avoid the duplicates in feeds


Please help me 

Thanks
Nagaraju
hi 

I am using formulae field,i entered text field value is andhra but same object update automaticlly same value in another field but starting letter is Capital letter.



thanks
Nagaraj
Can u plz help me , whenever task field updated then account field is updated.

trigger UpdateLastFacultyDate on Event (After Insert,After update) {
 
     //set of ids
     Set<id> AccId = New Set<id>();
     Set<Id> TskId = New Set<Id>();
     Map<Id,Event> mapofTsk = new Map<Id,Event>();
     For(Event evnt : Trigger.New)
     {
      if(evnt.type=='Faculty Engagement' && evnt.Event_Status__c=='Completed' && String.Valueof(evnt.Whatid).contains('001'))
        {
           AccId.Add(evnt.Whatid);
           TskId.Add(evnt.id);
           mapoftsk.put(evnt.Whatid,evnt);
           System.Debug('2nd'+evnt.ActivityDate);
           System.Debug('Map'+mapoftsk);
        }
     }
     //Map<Id,Task> mapofTsk = new Map<Id,Task>([Select id,WhatId,ActivityDate,type,Event_Status__c from Event where id IN: TskId]);
   
     if(AccId.size()>0)
     {
         // List of account to update
         List<Account> LAcc= New List<Account>();
        
         //Query for Account
         For(Account acc:[select id,Last_Faculty_Engagement__c from Account Where id IN :AccId])
         {
           acc.Last_Faculty_Engagement__c = mapoftsk.get(acc.id).ActivityDate;
           LAcc.Add(acc);
           System.Debug('3rd'+acc.Last_Faculty_Engagement__c);
        
         }
        
         If(LAcc.Size()>0)
         update LAcc;
     }   
}

thanks
nagaraj
Hi
i wrote the trigger my task is whenever Asset price field changes then update the same value in product object custom field New_Price_Value__c 
trigger updateContactDesriptionWithAccount on Product2(after insert,after update){

    set<id> conids=new set<id>();
    for(Product2 con:trigger.new){
    
        
        
            conids.add(con.id);
    
    }
    list<Product2> conlst=[select id,New_Price_Value__c,(select Price from Assets) from Product2 where id in:conids];
           
    for(Product2 c:conlst){
    
        New_Price_Value__c = c.Asset.Price ;
       
    }
    update conlst;
    
}

trigger updateContactDesriptionWithAccount on Product2(after insert,after update){

    set<id> conids=new set<id>();
    for(Product2 con:trigger.new){
    
        
        
            conids.add(con.id);
    
    }
    list<Product2> conlst=[select id,nagaraju__New_Price_Value__c,(select Price from Assets) from Product2 where id in:conids];
           
    for(Product2 c:conlst){
    
        c.trigger updateContactDesriptionWithAccount on Product2(after insert,after update){

    set<id> conids=new set<id>();
    for(Product2 con:trigger.new){
    
        
        
            conids.add(con.id);
    
    }
    list<Product2> conlst=[select id,nagaraju__New_Price_Value__c,(select Price from Assets) from Product2 where id in:conids];
           
    for(Product2 c:conlst){
    
        c.nagaraju__New_Price_Value__c = c.Asset.Price ;
       
    }
    update conlst;
    
}= c.Asset.Price ;
       
    }
    update conlst;
    
}

but i got the error like this *Error: Compile Error: Invalid foreign key relationship: Product2.Asset at line 15 column 40
Plz Can any one help me 
public with sharing class whitespace{
public String AccountID{get;set;}
public String PAccountID{get;set;}
public List<Account> IPlist{get;set;}


public whitespace(ApexPages.StandardController controller){
    AccountID = ApexPages.currentPage().getParameters().get('id');
           
    PAccountID = [select ParentId from Account where ID = :AccountID].ParentId;
    if (PAccountID == null){
        IPList = [select Name,(select Product_Family__c from Product_Releases_del__r) from Account a where ParentID =: AccountID];
    }
    else {
        IPList = [select Name,(select Product_Family__c from Product_Releases_del__r) from Account a where ParentID =: PAccountID];   
    }
    
}
    
    
        
        
}

This works, I just have no idea what writing test code entails
Hi Team,

 I want to know some basic ideas in sales force. Suppose I have a requirement to create a custom application 
 which is a CRM system for school management using SFDC. My Doubts are,
 
 1. How can I create the custom application?
 2. How can I integrate with sales force?
 3. How can I implement the trial periods in my app?
 4. How can I deliver my application?
 

I am new to SFDC and I have so many confusions about these questions. Could you please clarify my doubts? 
 
 
Hi everyone

Can you please tell how to lean step by step integration in salesforce .

Regards
Raj

 
User-added image
i have to created dynamically page block .

now how i remove it dynamically.

See the picture when i click on red button that block i want remove.

 
Hi

Create VF page and controller,If I will give MADRAS and INDIA ,need some output in UI,

Output
Display the Table format like   left column  display label and right column display temparatue.How can i achive this please send sample code anyone.

Regards
Raj
Hi 

global class batchDeleteEndUser implements Schedulable
{
    
    public static String CRON_EXP = '0 0 12 1 1/3 ? *';
 
    
    global static String scheduleIt() {
        batchDeleteEndUser delbatch = new batchDeleteEndUser();
        return System.schedule('Delete EndUser Batch', CRON_EXP, delbatch);
        } 
    
 
    
    global void execute(SchedulableContext sc) {
        
        Datetime days = system.now().addDays(-365);
        
       List<EndUser__c> objectList = new List<EndUser__c>();
         
        for (EndUser__c EUser: [
            select Id,name
            from EndUser__c
            where Id not in (select End_User__c from Case where status != 'Closed') and ((Time_of_Last_Created_Case__c<= :days and Time_of_Last_Initiated_Chat__c<=:days ) or (Time_of_Last_Created_Case__c=null and Time_of_Last_Initiated_Chat__c<=:days) or (Time_of_Last_Created_Case__c<= :days and Time_of_Last_Initiated_Chat__c=null))
        ]) {
            objectList.add(EUser);
           
        }
       
 
        if (!objectList.isEmpty()) {
           delete objectList;
           system.debug('enduser----'+objectList);
        }
  }  
}


Hi any one write the test class for above class its very urgent please---------------------

Thanks for Advance

Raj
Hi 

through vf page u will get one mail along with password in @mail there is link...
when u click on the link its ask enter password,
if u entered 3 times wrong password,it will through error ,  how can i achive this one through vf page plz anyone send me code 

Thanks in advance its needful very urgent 
Hi 
I am having four fields like  
nagaraju__Num1__c
nagaraju__Num2__c

nagaraju__Number1__c
nagaraju__Number2__c
whenever these two fields nagaraju__Num1__c,nagaraju__Num2__c equal to null remaing two fields are sum and update the formula field .

I wrote this condition but in that formula true conditon not working only false conditon working let me know the what i mistake plz 

IF((nagaraju__Num1__c == null && nagaraju__Num2__c == null),nagaraju__Number1__c + nagaraju__Number2__c,nagaraju__Num1__c + nagaraju__Num2__c)

thanks 
Raj
hi 

I am using formulae field,i entered text field value is andhra but same object update automaticlly same value in another field but starting letter is Capital letter.



thanks
Nagaraj
Can u plz help me , whenever task field updated then account field is updated.

trigger UpdateLastFacultyDate on Event (After Insert,After update) {
 
     //set of ids
     Set<id> AccId = New Set<id>();
     Set<Id> TskId = New Set<Id>();
     Map<Id,Event> mapofTsk = new Map<Id,Event>();
     For(Event evnt : Trigger.New)
     {
      if(evnt.type=='Faculty Engagement' && evnt.Event_Status__c=='Completed' && String.Valueof(evnt.Whatid).contains('001'))
        {
           AccId.Add(evnt.Whatid);
           TskId.Add(evnt.id);
           mapoftsk.put(evnt.Whatid,evnt);
           System.Debug('2nd'+evnt.ActivityDate);
           System.Debug('Map'+mapoftsk);
        }
     }
     //Map<Id,Task> mapofTsk = new Map<Id,Task>([Select id,WhatId,ActivityDate,type,Event_Status__c from Event where id IN: TskId]);
   
     if(AccId.size()>0)
     {
         // List of account to update
         List<Account> LAcc= New List<Account>();
        
         //Query for Account
         For(Account acc:[select id,Last_Faculty_Engagement__c from Account Where id IN :AccId])
         {
           acc.Last_Faculty_Engagement__c = mapoftsk.get(acc.id).ActivityDate;
           LAcc.Add(acc);
           System.Debug('3rd'+acc.Last_Faculty_Engagement__c);
        
         }
        
         If(LAcc.Size()>0)
         update LAcc;
     }   
}

thanks
nagaraj
Hi
i wrote the trigger my task is whenever Asset price field changes then update the same value in product object custom field New_Price_Value__c 
trigger updateContactDesriptionWithAccount on Product2(after insert,after update){

    set<id> conids=new set<id>();
    for(Product2 con:trigger.new){
    
        
        
            conids.add(con.id);
    
    }
    list<Product2> conlst=[select id,New_Price_Value__c,(select Price from Assets) from Product2 where id in:conids];
           
    for(Product2 c:conlst){
    
        New_Price_Value__c = c.Asset.Price ;
       
    }
    update conlst;
    
}

trigger updateContactDesriptionWithAccount on Product2(after insert,after update){

    set<id> conids=new set<id>();
    for(Product2 con:trigger.new){
    
        
        
            conids.add(con.id);
    
    }
    list<Product2> conlst=[select id,nagaraju__New_Price_Value__c,(select Price from Assets) from Product2 where id in:conids];
           
    for(Product2 c:conlst){
    
        c.trigger updateContactDesriptionWithAccount on Product2(after insert,after update){

    set<id> conids=new set<id>();
    for(Product2 con:trigger.new){
    
        
        
            conids.add(con.id);
    
    }
    list<Product2> conlst=[select id,nagaraju__New_Price_Value__c,(select Price from Assets) from Product2 where id in:conids];
           
    for(Product2 c:conlst){
    
        c.nagaraju__New_Price_Value__c = c.Asset.Price ;
       
    }
    update conlst;
    
}= c.Asset.Price ;
       
    }
    update conlst;
    
}

but i got the error like this *Error: Compile Error: Invalid foreign key relationship: Product2.Asset at line 15 column 40
Plz Can any one help me