-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
4Questions
-
4Replies
Urgent - Formula Query.
I wanted to convert Days,Hours into Minutes and populate the value in minutes field as a SUM value of all i.e. (Days(should be converted into minutes)+Hours(should be converted into minutes) +Minutes = Minutes).
Example:
I have a field Days which is populated from below formula:
Text( FLOOR( Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c ) )
Now, I want to populate Minutes value which should be a SUM of Days(converted to mins)+Hours(converted to mins)+Minutes for which I have a formula as shown below:
Text(FLOOR((( Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c) *1440)*24) //Days//
+
Text(ROUND(((Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c )*60),0)) //Hours//
+
Text(ROUND(((Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c ))))) //Minutes//
When I try to execute the formula, I get an error as :
Error: Incorrect parameter type for operator '+'. Expected Number, Date, DateTime, received Text
Please assist me with the correct formula to display the value in minutes.
Thanks in advance!
- Heena Chauhan
- July 13, 2016
- Like
- 0
Related List Query!
I have a custom object 'LTD Activity' on which I am trying to create a Related List 'NRSWA' and wanted to populate with the list of all Activity records with the same NRSWA No.records.
Fields need to be displayed:
1. Activity Ref
2. Reinst. Request No
3. Street
4. Town
5. Notification Type
6. Activity Status
7. Reinst. Status
8. Site Clear
9. Public Site Clear
10. Ongoing
Also, need a filter criteria for the same, When the NRSWA field is blank,it should not show the related list of all the other records within SIS with no NRSWA number.
There will not be any New/Edit/Delete Activity button/Link within that related list.
Thanks in advance!
- Heena Chauhan
- June 13, 2016
- Like
- 0
Updating Class:
Hello Everytone,
Please assist me in updating an existing Apex Class to be updated with new created fields:
I have below new created fields and need to mapp and follow the current process:
dateTime - Created in App (new field)
dateUploaded - Portal Upload (new field)
dateToISIS - Sent to Isis (new field)
completed - Completed (new field)
Below is the existing class which I have to update using the new fields. Object name is:
Acumen Reinstatment Header.
Please assist!
Thank You!
public with sharing class tRIIO_AcumenPrivateReinstatementToISIS { public HeaderImages objHeaderImages; public List<HeaderImages> lstImages = new List<HeaderImages>(); public String vStrEast = ''; public String vStrNorthing = ''; public static DescribeSObjectResult headerObjectType,lineObjectType; public class HeaderImages{ String FileName; Blob blobData; } public String processPrvtReinstatementXML(Blob xmlData, id acumenId){ string strResponseData=''; string strMsg=''; Acumen_Reinstatement_Header__c objRH; Acumen_Reinstatement_Line__c objRL; string strAttachment=''; boolean bolCheckLI=false; string sValue=''; string supplierValue = ''; //Ch03 List<Acumen_Reinstatement_Line__c> objARLineList = new List<Acumen_Reinstatement_Line__c>(); //Ch03 List<Acumen_Reinstatement_Header__c> objARHeaderList = new List<Acumen_Reinstatement_Header__c>(); //Ch03 headerObjectType = Schema.getGlobalDescribe().get('Acumen_Reinstatement_Header__c').getDescribe(); lineObjectType = Schema.getGlobalDescribe().get('Acumen_Reinstatement_Line__c').getDescribe(); System.debug('@#@# GDFO Header = '+headerObjectType); System.debug('@#@# GDFO Line = '+lineObjectType); DOM.Document xmlDoc = new dom.Document(); xmldoc.load(xmlData.toString()); DOM.Xmlnode node= xmldoc.getRootElement(); for(DOM.Xmlnode nodeparent : node.getChildElements()){ try{ if(nodeparent.getName().equalsIgnoreCase('reinstatement')){ System.debug('@@Inside loop'); for(DOM.Xmlnode nodereinstatementPvtRecord : nodeparent.getChildElements()){ //CHild Iteration System.debug('==>> @@ '+nodereinstatementPvtRecord.getName()+', Value = '+nodereinstatementPvtRecord.getText()); if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('projectReference') && nodereinstatementPvtRecord.getText() != ''){ sValue=GDFO_Acumen_Utility.sValidateFieldValue1(headerObjectType, 'Project_Reference__c',nodereinstatementPvtRecord.getText()); if(sValue!=null) objRH.Project_Reference__c=nodereinstatementPvtRecord.getText(); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('propertyLine1') && nodereinstatementPvtRecord.getText() != ''){ sValue=GDFO_Acumen_Utility.sValidateFieldValue1(headerObjectType, 'Location__c',nodereinstatementPvtRecord.getText()); if(sValue!=null) objRH.Location__c=nodereinstatementPvtRecord.getText(); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('propertyStreet') && nodereinstatementPvtRecord.getText() != ''){ sValue=GDFO_Acumen_Utility.sValidateFieldValue1(headerObjectType, 'Street__c',nodereinstatementPvtRecord.getText()); if(sValue!=null) objRH.Street__c=nodereinstatementPvtRecord.getText(); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('propertyTown') && nodereinstatementPvtRecord.getText() != ''){ sValue=GDFO_Acumen_Utility.sValidateFieldValue1(headerObjectType, 'Town__c',nodereinstatementPvtRecord.getText()); if(sValue!=null) objRH.Town__c=nodereinstatementPvtRecord.getText(); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('material') && nodereinstatementPvtRecord.getText() != ''){ String materialText= nodereinstatementPvtRecord.getText(); if(materialText=='DBM') objRL.Surface__c = nodereinstatementPvtRecord.getText(); else if(materialText=='Concrete') objRL.Surface__c='CON'; else if(materialText=='Blocks') objRL.Surface__c='MOD'; else if(materialText=='Slabs') objRL.Surface__c='SLB'; else if(materialText=='Turf'){ objRL.Surface__c='VRG'; objRL.Wearing_Course_Comments__c='Turf'; } else if(materialText=='Edging') objRL.Wearing_Course_Comments__c='Edging'; else if(materialText=='Other') objRL.Wearing_Course_Comments__c='Other'; else objRL.Surface__c=materialText; } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('length') && nodereinstatementPvtRecord.getText() != ''){ sValue=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Length_m__c',nodereinstatementPvtRecord.getText()); if(sValue!=null) objRL.Length_m__c=decimal.valueof(sValue); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('location') && nodereinstatementPvtRecord.getText() != ''){ objRL.Location__c=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Location__c',nodereinstatementPvtRecord.getText()); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('easting') && nodereinstatementPvtRecord.getText() != ''){ system.debug('@@ In tag objRL.Eastings__c--'+objRL.Eastings__c + '***'+nodereinstatementPvtRecord.getText()); objRL.Eastings__c=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Eastings__c',nodereinstatementPvtRecord.getText()); system.debug('@@ out tag objRL.Eastings__c--'+objRL.Eastings__c); objRL = LLtoEN(objRL); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('northing') && nodereinstatementPvtRecord.getText() != ''){ system.debug('@@ In tag objRL.Northings__c--'+objRL.Northings__c + '***'+nodereinstatementPvtRecord.getText()); objRL.Northings__c=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Northings__c',nodereinstatementPvtRecord.getText()); objRL = LLtoEN(objRL); system.debug('@@ out tag objRL.Northings__c--'+objRL.Northings__c); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('width') && nodereinstatementPvtRecord.getText() != ''){ sValue=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Width_m__c',nodereinstatementPvtRecord.getText()); system.debug('@@ width Svalue---'+sValue); if(sValue!=null) objRL.Width_m__c=decimal.valueof(sValue); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('depth') && nodereinstatementPvtRecord.getText() != ''){ sValue=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Overall_Depth_mm__c',nodereinstatementPvtRecord.getText()); system.debug('@@Overall_Depth_mm__c--'+sValue); if(sValue!=null && nodereinstatementPvtRecord.getText() != '' && decimal.valueof(nodereinstatementPvtRecord.getText())>0.1 ) { objRL.Overall_Depth_mm__c=GDFO_Acumen_Utility.convertMeterToMillimeter(double.valueof(sValue)); objRL.BF_Length_m__c=objRL.Length_m__c; objRL.BF_Width_m__c=objRL.Width_m__c; } } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('comments') && nodereinstatementPvtRecord.getText() != ''){ system.debug('@@comments--'+GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Wearing_Course_Comments__c',nodereinstatementPvtRecord.getText())); objRL.Wearing_Course_Comments__c=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Wearing_Course_Comments__c',nodereinstatementPvtRecord.getText())+ ((objRL.Wearing_Course_Comments__c!=null) ? objRL.Wearing_Course_Comments__c :'') ; } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('dateTime') && nodereinstatementPvtRecord.getText() != ''){ system.debug('@@ dateTime Excavation_Date__c-'+nodereinstatementPvtRecord.getText() ); sValue=GDFO_Acumen_Utility.convertDateTimeTodate(nodereinstatementPvtRecord.getText()); system.debug('@@Excavation_Date__c-'+sValue); if(sValue!=null) objRL.Excavation_Date__c=date.valueof(sValue); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('supplier') && nodereinstatementPvtRecord.getText() != ''){ system.debug('@@ Company -Company__c -->'+nodereinstatementPvtRecord.getText() ); supplierValue = nodereinstatementPvtRecord.getText(); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('gasEndDate')){ if(nodereinstatementPvtRecord.getText() != ''){ system.debug('@@Reinstatement_Ready_Date__c-'+nodereinstatementPvtRecord.getText()); sValue=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Reinstatement_Ready_Date__c',nodereinstatementPvtRecord.getText()); system.debug('@@ sValue Reinstatement_Ready_Date__c-'+sValue); if(sValue!=null) objRL.Reinstatement_Ready_Date__c=date.valueof(sValue); } } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('imageData')){ objHeaderImages = new HeaderImages(); for(DOM.Xmlnode nodeImages : nodereinstatementPvtRecord.getChildElements()){ if(nodeImages.getName().toLowerCase().contains('filename')){ objHeaderImages.FileName = nodeImages.getText(); } else if(nodeImages.getName().toLowerCase().contains('image')){ objHeaderImages.blobData = EncodingUtil.base64Decode(nodeImages.getText()); } } if(objHeaderImages.FileName != null && objHeaderImages.blobData != null){ lstImages.add(objHeaderImages); } system.debug('-----test image.size()'+lstImages.size()); if(lstImages.size()>0) strAttachment=AddAttachments(string.valueOf(objRH.Id), lstImages); lstImages = new List<HeaderImages>(); } catch(Exception ex){ strMsg='Error :' + ex.getMessage() + ' \n' + ex.getStackTraceString(); system.debug('## strMsg:' + strMsg); } finally{ if(objRH != null ){ objRH.Is_Error__c = (strMsg.contains('Error') ? true : false); objRH.Errors__c = (strMsg.contains('Error') ? strMsg : ''); strResponseData = getSendMessageResponse(strMsg); objARHeaderList.add(objRH);//Ch03 //update objRH; } if(objRL != null ) { objRL.Public_or_Private__c='Private'; // CH01. New system.debug('@@@objRL.Eastings__c-'+objRL.Eastings__c); system.debug('@@@objRL.Northings__c-'+objRL.Northings__c); //update objRL;//Ch03 } } } update objARHeaderList; List<tRIIO_Companies__c> objTRIIOCompany = [select id,Name__c from tRIIO_Companies__c WHERE Name__c =: supplierValue ORDER By LastModifiedDate DESC LIMIT 1];// system.debug('@@objTRIIOCompany -->'+objTRIIOCompany); if(!objTRIIOCompany.isEmpty()) objRL.Company__c = objTRIIOCompany[0].id; objARLineList.add(objRL); system.debug('objARLineList--->' + objARLineList); update objARLineList; return strResponseData; } public static string getSendMessageResponse(String strMsg){ string strResponseXML ; if(strMsg.contains('Error')){ strResponseXML = 'Error : Data received with incorrect values'; //strMsg; } else { strResponseXML = 'Success : Data saved successfully'; } return strResponseXML; } public static string AddAttachments(string newParentRef, List<HeaderImages> lstImages) //string imgBinaryData, string imgName, string newParentRef) { string strFiles = ''; try { system.debug('@@lstAttach'+newParentRef); system.debug('@@lstAttach'+lstImages); list<Attachment> lstAttach = new list<Attachment>(); for(HeaderImages obj:lstImages ){ Attachment objAttach = new Attachment(); objAttach.ParentId = newParentRef; objAttach.Name = obj.FileName ; objAttach.Body = obj.blobData; objAttach.Description = 'image/jpg'; lstAttach.add(objAttach); strFiles += obj.FileName + ','; } if(lstAttach.size()>0){ system.debug('-----lstAttach'+lstAttach.size()); insert lstAttach; } if (strFiles.length()>0){ system.debug('@@strFiles'+strFiles.length()); return ''; } else{ system.debug('@@else strFiles-'+strFiles.length()); return ''; } } catch(Exception ex){ system.debug('@@error strFiles:'+strFiles.length()); return 'Error : ' + ex.getMessage() + ' \n' + ex.getStackTraceString(); } } public Acumen_Reinstatement_Line__c LLtoEN(Acumen_Reinstatement_Line__c RL){ TOAConvertLatLonToEN obj; RL.h_Eastings__c = RL.Eastings__c; RL.h_Northings__c = RL.Northings__c; System.debug('@@objRL.Eastings__c-'+RL.Eastings__c); System.debug('@@objRL.Northings__c-'+RL.Northings__c); if(RL.Eastings__c != '' && RL.Eastings__c != null && RL.Northings__c != '' && RL.Northings__c != null){ vStrEast = RL.Eastings__c.replaceAll('°',''); vStrEast = vStrEast.replaceAll('�',''); vStrNorthing = RL.Northings__c.replaceAll('°',''); vStrNorthing = vStrNorthing.replaceAll('�',''); if(Pattern.matches('^[0-9,-]*\\d*(\\.\\d+)?$',vStrEast ) && Pattern.matches('^[0-9,-]*\\d*(\\.\\d+)?$',vStrNorthing )){ obj = new TOAConvertLatLonToEN(double.valueOf(vStrEast ), double.valueOf(vStrNorthing ), double.valueOf('0.00')); obj.LLtoNE(double.valueOf(vStrEast), double.valueOf(vStrNorthing)); System.debug('@@obj.estr-'+obj.estr); System.debug('@@obj.nstr-'+obj.nstr); RL.Eastings__c = obj.estr; RL.Northings__c = obj.nstr; }//end if checking the decimal or not }//end if checking the Northings , Eastings values are null or not return RL; }
- Heena Chauhan
- May 23, 2016
- Like
- 0
Is it possible using Trigger?
I am creating a picklist field with 5 different values, where while adding the value, for each specific value I am adding a description in the decription field (which we get while adding a picklist value); In that description field, I need to add another field value and that should be displayed when user select a specific value from the pikclist dropdown, than in hover details, the user should be able to see the description data + the field value.
Example:
In Opportunity, when we select a value say "Closed Won" and if we hover the details for "Closed Won" than we should get the details as " You won this Opportunity on 17 May 2016".
So here 17 May,2016 is another field on Opportunity whoes details are displayed in the hover detail of stage field when user select a specific value.
Can someone please assist whether this is possible with the standard functionality or need a Trigger?
Thanks in advance!
Heena
- Heena Chauhan
- May 17, 2016
- Like
- 0
Urgent - Formula Query.
I wanted to convert Days,Hours into Minutes and populate the value in minutes field as a SUM value of all i.e. (Days(should be converted into minutes)+Hours(should be converted into minutes) +Minutes = Minutes).
Example:
I have a field Days which is populated from below formula:
Text( FLOOR( Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c ) )
Now, I want to populate Minutes value which should be a SUM of Days(converted to mins)+Hours(converted to mins)+Minutes for which I have a formula as shown below:
Text(FLOOR((( Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c) *1440)*24) //Days//
+
Text(ROUND(((Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c )*60),0)) //Hours//
+
Text(ROUND(((Date_Time_Gas_Off__c - Date_Time_Gas_Riser_Commissioned__c ))))) //Minutes//
When I try to execute the formula, I get an error as :
Error: Incorrect parameter type for operator '+'. Expected Number, Date, DateTime, received Text
Please assist me with the correct formula to display the value in minutes.
Thanks in advance!
- Heena Chauhan
- July 13, 2016
- Like
- 0
Updating Class:
Hello Everytone,
Please assist me in updating an existing Apex Class to be updated with new created fields:
I have below new created fields and need to mapp and follow the current process:
dateTime - Created in App (new field)
dateUploaded - Portal Upload (new field)
dateToISIS - Sent to Isis (new field)
completed - Completed (new field)
Below is the existing class which I have to update using the new fields. Object name is:
Acumen Reinstatment Header.
Please assist!
Thank You!
public with sharing class tRIIO_AcumenPrivateReinstatementToISIS { public HeaderImages objHeaderImages; public List<HeaderImages> lstImages = new List<HeaderImages>(); public String vStrEast = ''; public String vStrNorthing = ''; public static DescribeSObjectResult headerObjectType,lineObjectType; public class HeaderImages{ String FileName; Blob blobData; } public String processPrvtReinstatementXML(Blob xmlData, id acumenId){ string strResponseData=''; string strMsg=''; Acumen_Reinstatement_Header__c objRH; Acumen_Reinstatement_Line__c objRL; string strAttachment=''; boolean bolCheckLI=false; string sValue=''; string supplierValue = ''; //Ch03 List<Acumen_Reinstatement_Line__c> objARLineList = new List<Acumen_Reinstatement_Line__c>(); //Ch03 List<Acumen_Reinstatement_Header__c> objARHeaderList = new List<Acumen_Reinstatement_Header__c>(); //Ch03 headerObjectType = Schema.getGlobalDescribe().get('Acumen_Reinstatement_Header__c').getDescribe(); lineObjectType = Schema.getGlobalDescribe().get('Acumen_Reinstatement_Line__c').getDescribe(); System.debug('@#@# GDFO Header = '+headerObjectType); System.debug('@#@# GDFO Line = '+lineObjectType); DOM.Document xmlDoc = new dom.Document(); xmldoc.load(xmlData.toString()); DOM.Xmlnode node= xmldoc.getRootElement(); for(DOM.Xmlnode nodeparent : node.getChildElements()){ try{ if(nodeparent.getName().equalsIgnoreCase('reinstatement')){ System.debug('@@Inside loop'); for(DOM.Xmlnode nodereinstatementPvtRecord : nodeparent.getChildElements()){ //CHild Iteration System.debug('==>> @@ '+nodereinstatementPvtRecord.getName()+', Value = '+nodereinstatementPvtRecord.getText()); if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('projectReference') && nodereinstatementPvtRecord.getText() != ''){ sValue=GDFO_Acumen_Utility.sValidateFieldValue1(headerObjectType, 'Project_Reference__c',nodereinstatementPvtRecord.getText()); if(sValue!=null) objRH.Project_Reference__c=nodereinstatementPvtRecord.getText(); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('propertyLine1') && nodereinstatementPvtRecord.getText() != ''){ sValue=GDFO_Acumen_Utility.sValidateFieldValue1(headerObjectType, 'Location__c',nodereinstatementPvtRecord.getText()); if(sValue!=null) objRH.Location__c=nodereinstatementPvtRecord.getText(); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('propertyStreet') && nodereinstatementPvtRecord.getText() != ''){ sValue=GDFO_Acumen_Utility.sValidateFieldValue1(headerObjectType, 'Street__c',nodereinstatementPvtRecord.getText()); if(sValue!=null) objRH.Street__c=nodereinstatementPvtRecord.getText(); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('propertyTown') && nodereinstatementPvtRecord.getText() != ''){ sValue=GDFO_Acumen_Utility.sValidateFieldValue1(headerObjectType, 'Town__c',nodereinstatementPvtRecord.getText()); if(sValue!=null) objRH.Town__c=nodereinstatementPvtRecord.getText(); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('material') && nodereinstatementPvtRecord.getText() != ''){ String materialText= nodereinstatementPvtRecord.getText(); if(materialText=='DBM') objRL.Surface__c = nodereinstatementPvtRecord.getText(); else if(materialText=='Concrete') objRL.Surface__c='CON'; else if(materialText=='Blocks') objRL.Surface__c='MOD'; else if(materialText=='Slabs') objRL.Surface__c='SLB'; else if(materialText=='Turf'){ objRL.Surface__c='VRG'; objRL.Wearing_Course_Comments__c='Turf'; } else if(materialText=='Edging') objRL.Wearing_Course_Comments__c='Edging'; else if(materialText=='Other') objRL.Wearing_Course_Comments__c='Other'; else objRL.Surface__c=materialText; } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('length') && nodereinstatementPvtRecord.getText() != ''){ sValue=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Length_m__c',nodereinstatementPvtRecord.getText()); if(sValue!=null) objRL.Length_m__c=decimal.valueof(sValue); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('location') && nodereinstatementPvtRecord.getText() != ''){ objRL.Location__c=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Location__c',nodereinstatementPvtRecord.getText()); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('easting') && nodereinstatementPvtRecord.getText() != ''){ system.debug('@@ In tag objRL.Eastings__c--'+objRL.Eastings__c + '***'+nodereinstatementPvtRecord.getText()); objRL.Eastings__c=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Eastings__c',nodereinstatementPvtRecord.getText()); system.debug('@@ out tag objRL.Eastings__c--'+objRL.Eastings__c); objRL = LLtoEN(objRL); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('northing') && nodereinstatementPvtRecord.getText() != ''){ system.debug('@@ In tag objRL.Northings__c--'+objRL.Northings__c + '***'+nodereinstatementPvtRecord.getText()); objRL.Northings__c=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Northings__c',nodereinstatementPvtRecord.getText()); objRL = LLtoEN(objRL); system.debug('@@ out tag objRL.Northings__c--'+objRL.Northings__c); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('width') && nodereinstatementPvtRecord.getText() != ''){ sValue=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Width_m__c',nodereinstatementPvtRecord.getText()); system.debug('@@ width Svalue---'+sValue); if(sValue!=null) objRL.Width_m__c=decimal.valueof(sValue); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('depth') && nodereinstatementPvtRecord.getText() != ''){ sValue=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Overall_Depth_mm__c',nodereinstatementPvtRecord.getText()); system.debug('@@Overall_Depth_mm__c--'+sValue); if(sValue!=null && nodereinstatementPvtRecord.getText() != '' && decimal.valueof(nodereinstatementPvtRecord.getText())>0.1 ) { objRL.Overall_Depth_mm__c=GDFO_Acumen_Utility.convertMeterToMillimeter(double.valueof(sValue)); objRL.BF_Length_m__c=objRL.Length_m__c; objRL.BF_Width_m__c=objRL.Width_m__c; } } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('comments') && nodereinstatementPvtRecord.getText() != ''){ system.debug('@@comments--'+GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Wearing_Course_Comments__c',nodereinstatementPvtRecord.getText())); objRL.Wearing_Course_Comments__c=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Wearing_Course_Comments__c',nodereinstatementPvtRecord.getText())+ ((objRL.Wearing_Course_Comments__c!=null) ? objRL.Wearing_Course_Comments__c :'') ; } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('dateTime') && nodereinstatementPvtRecord.getText() != ''){ system.debug('@@ dateTime Excavation_Date__c-'+nodereinstatementPvtRecord.getText() ); sValue=GDFO_Acumen_Utility.convertDateTimeTodate(nodereinstatementPvtRecord.getText()); system.debug('@@Excavation_Date__c-'+sValue); if(sValue!=null) objRL.Excavation_Date__c=date.valueof(sValue); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('supplier') && nodereinstatementPvtRecord.getText() != ''){ system.debug('@@ Company -Company__c -->'+nodereinstatementPvtRecord.getText() ); supplierValue = nodereinstatementPvtRecord.getText(); } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('gasEndDate')){ if(nodereinstatementPvtRecord.getText() != ''){ system.debug('@@Reinstatement_Ready_Date__c-'+nodereinstatementPvtRecord.getText()); sValue=GDFO_Acumen_Utility.sValidateFieldValue1(lineObjectType, 'Reinstatement_Ready_Date__c',nodereinstatementPvtRecord.getText()); system.debug('@@ sValue Reinstatement_Ready_Date__c-'+sValue); if(sValue!=null) objRL.Reinstatement_Ready_Date__c=date.valueof(sValue); } } else if(nodereinstatementPvtRecord.getName().equalsIgnoreCase('imageData')){ objHeaderImages = new HeaderImages(); for(DOM.Xmlnode nodeImages : nodereinstatementPvtRecord.getChildElements()){ if(nodeImages.getName().toLowerCase().contains('filename')){ objHeaderImages.FileName = nodeImages.getText(); } else if(nodeImages.getName().toLowerCase().contains('image')){ objHeaderImages.blobData = EncodingUtil.base64Decode(nodeImages.getText()); } } if(objHeaderImages.FileName != null && objHeaderImages.blobData != null){ lstImages.add(objHeaderImages); } system.debug('-----test image.size()'+lstImages.size()); if(lstImages.size()>0) strAttachment=AddAttachments(string.valueOf(objRH.Id), lstImages); lstImages = new List<HeaderImages>(); } catch(Exception ex){ strMsg='Error :' + ex.getMessage() + ' \n' + ex.getStackTraceString(); system.debug('## strMsg:' + strMsg); } finally{ if(objRH != null ){ objRH.Is_Error__c = (strMsg.contains('Error') ? true : false); objRH.Errors__c = (strMsg.contains('Error') ? strMsg : ''); strResponseData = getSendMessageResponse(strMsg); objARHeaderList.add(objRH);//Ch03 //update objRH; } if(objRL != null ) { objRL.Public_or_Private__c='Private'; // CH01. New system.debug('@@@objRL.Eastings__c-'+objRL.Eastings__c); system.debug('@@@objRL.Northings__c-'+objRL.Northings__c); //update objRL;//Ch03 } } } update objARHeaderList; List<tRIIO_Companies__c> objTRIIOCompany = [select id,Name__c from tRIIO_Companies__c WHERE Name__c =: supplierValue ORDER By LastModifiedDate DESC LIMIT 1];// system.debug('@@objTRIIOCompany -->'+objTRIIOCompany); if(!objTRIIOCompany.isEmpty()) objRL.Company__c = objTRIIOCompany[0].id; objARLineList.add(objRL); system.debug('objARLineList--->' + objARLineList); update objARLineList; return strResponseData; } public static string getSendMessageResponse(String strMsg){ string strResponseXML ; if(strMsg.contains('Error')){ strResponseXML = 'Error : Data received with incorrect values'; //strMsg; } else { strResponseXML = 'Success : Data saved successfully'; } return strResponseXML; } public static string AddAttachments(string newParentRef, List<HeaderImages> lstImages) //string imgBinaryData, string imgName, string newParentRef) { string strFiles = ''; try { system.debug('@@lstAttach'+newParentRef); system.debug('@@lstAttach'+lstImages); list<Attachment> lstAttach = new list<Attachment>(); for(HeaderImages obj:lstImages ){ Attachment objAttach = new Attachment(); objAttach.ParentId = newParentRef; objAttach.Name = obj.FileName ; objAttach.Body = obj.blobData; objAttach.Description = 'image/jpg'; lstAttach.add(objAttach); strFiles += obj.FileName + ','; } if(lstAttach.size()>0){ system.debug('-----lstAttach'+lstAttach.size()); insert lstAttach; } if (strFiles.length()>0){ system.debug('@@strFiles'+strFiles.length()); return ''; } else{ system.debug('@@else strFiles-'+strFiles.length()); return ''; } } catch(Exception ex){ system.debug('@@error strFiles:'+strFiles.length()); return 'Error : ' + ex.getMessage() + ' \n' + ex.getStackTraceString(); } } public Acumen_Reinstatement_Line__c LLtoEN(Acumen_Reinstatement_Line__c RL){ TOAConvertLatLonToEN obj; RL.h_Eastings__c = RL.Eastings__c; RL.h_Northings__c = RL.Northings__c; System.debug('@@objRL.Eastings__c-'+RL.Eastings__c); System.debug('@@objRL.Northings__c-'+RL.Northings__c); if(RL.Eastings__c != '' && RL.Eastings__c != null && RL.Northings__c != '' && RL.Northings__c != null){ vStrEast = RL.Eastings__c.replaceAll('°',''); vStrEast = vStrEast.replaceAll('�',''); vStrNorthing = RL.Northings__c.replaceAll('°',''); vStrNorthing = vStrNorthing.replaceAll('�',''); if(Pattern.matches('^[0-9,-]*\\d*(\\.\\d+)?$',vStrEast ) && Pattern.matches('^[0-9,-]*\\d*(\\.\\d+)?$',vStrNorthing )){ obj = new TOAConvertLatLonToEN(double.valueOf(vStrEast ), double.valueOf(vStrNorthing ), double.valueOf('0.00')); obj.LLtoNE(double.valueOf(vStrEast), double.valueOf(vStrNorthing)); System.debug('@@obj.estr-'+obj.estr); System.debug('@@obj.nstr-'+obj.nstr); RL.Eastings__c = obj.estr; RL.Northings__c = obj.nstr; }//end if checking the decimal or not }//end if checking the Northings , Eastings values are null or not return RL; }
- Heena Chauhan
- May 23, 2016
- Like
- 0
Is it possible using Trigger?
I am creating a picklist field with 5 different values, where while adding the value, for each specific value I am adding a description in the decription field (which we get while adding a picklist value); In that description field, I need to add another field value and that should be displayed when user select a specific value from the pikclist dropdown, than in hover details, the user should be able to see the description data + the field value.
Example:
In Opportunity, when we select a value say "Closed Won" and if we hover the details for "Closed Won" than we should get the details as " You won this Opportunity on 17 May 2016".
So here 17 May,2016 is another field on Opportunity whoes details are displayed in the hover detail of stage field when user select a specific value.
Can someone please assist whether this is possible with the standard functionality or need a Trigger?
Thanks in advance!
Heena
- Heena Chauhan
- May 17, 2016
- Like
- 0