-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
5Questions
-
3Replies
HI Forum, I am facing same issue in VF page please help me out.
Hi,
-i want image placed in side by side but i will show vertically.
- requrement is simple:
- i want grand chaild of image URL field Show on Parent object.
IP(Parent Object) --> WO(Child Object) --- Grand Child(SI)
*******APEX controller***********************
public class WorkOrdersInstaIPTemplateSharinPixImage{ public List<IP_Template__c> IPTemplateLst {get;set;} public List<String> urlList {get;set;} public Map<String, List<ImageParam>> urlString{get;set;} public Boolean hasNoImage{set;get{ return urlString.size()==0?true:false; }} public WorkOrdersInstaIPTemplateSharinPixImage (ApexPages.StandardController stdCtrl) { Id workOrderId = stdCtrl.getId(); // Work order ID urlString= new Map<String, List<ImageParam>>(); Set <ID> installedProductSet= new Set <ID>(); // SET of Installed Product ID System.debug('Installed Product :' + installedProductSet); List<SVMXC__Service_Order__c> workOrderLSt = new List<SVMXC__Service_Order__c>(); //List Of Work Order workOrderLSt=[select Id,SVMXC__Component__c,IP_Template_Type__c from SVMXC__Service_Order__c where Id = :workOrderId AND IP_Template_Type__c !=NUll]; //Fetch the Wo related Installed Product for(SVMXC__Service_Order__c woInstall: workOrderLSt) { system.debug('woInstall.SVMXC__Component__c:- '+woInstall.SVMXC__Component__c); installedProductSet.add(woInstall.SVMXC__Component__c); system.debug('installedProductSet:- '+installedProductSet); } IPTemplateLst= [SELECT Id,Type__c,Installed_Product__c,Title__c, (Select Id, sharinpix__ImageURLFull__c,Landscape_Portrait__c,sharinpix__FileName__c, sharinpix__AlbumID__c FROM SharinPix_Images__r order by sharinpix__SortPosition__c ASC), (SELECT Id, sharinpix__SharinPix_Token__c FROM SharinPix_Albums__r) FROM IP_Template__c Where Installed_Product__c IN:installedProductSet AND Type__c!=Null ORDER BY Title__c ASC]; //Fetch the IP temate related to Installed Product urlList= new List<String>(); System.debug('IPTemplateLst :'+IPTemplateLst); List<IP_Template__c> IPTemplate = new List<IP_Template__c>(); For(IP_Template__c ip: IPTemplateLst) { For(SVMXC__Service_Order__c work:workOrderLSt) { if((ip.Installed_Product__c==work.SVMXC__Component__c)&& (ip.Type__c==work.IP_Template_Type__c )) { IPTemplate.add(ip); } } } for(IP_Template__c titleUrl:IPTemplateLst) { List<ImageParam> urlValues = new List<ImageParam>(); for(SVMXC__Service_Order__c work:workOrderLSt){ if((titleUrl.Installed_Product__c==work.SVMXC__Component__c)&& (titleUrl.Type__c==work.IP_Template_Type__c ) ) { for(sharinpix__SharinPixImage__c b: titleUrl.SharinPix_Images__r) { urlValues.add(new ImageParam(b, titleUrl.SharinPix_Albums__r[0].sharinpix__SharinPix_Token__c)); } urlString.put(titleUrl.Title__c, urlValues); } } } System.debug('urlString :'+urlString); } public class ImageParam{ public String imageUrl{set;get;} public String albumId{set;get;} public String tokenString{set;get;} public String LandscapePortrait{set;get;} public String fileName{set;get;} public ImageParam(sharinpix__SharinPixImage__c img, String tokenString){ this.imageUrl = img.sharinpix__ImageURLFull__c; this.albumId = img.sharinpix__AlbumID__c; this.LandscapePortrait = img.Landscape_Portrait__c; this.fileName = img.sharinpix__FileName__c; sharinpix.Client spClient = sharinpix.Client.getInstance(); Map<String, Object> params = new Map<String, Object> { 'album_id' => albumId, 'path' => '/pagelayout/'+albumId, 'exp' => (DateTime.now().getTime()/1000) + 300, 'Id' => albumId, 'abilities' => new Map<String, Object> { 'tags' => new Map<String, Object> { 'read' => true }, albumId => new Map<String, Object> { 'Access' => new Map<String, Object> { 'see' => true, 'image_list' => true, 'image_upload' => true, 'image_delete' => true, 'image_annotate' => true, 'image_tag' => true }, 'Display' => new Map<String, Object>{ 'see' => true, 'tags' => true, 'date' => 'L' } } } }; this.tokenString = spClient.token(params); } } }************* VF code***************
<apex:page standardController="SVMXC__Service_Order__c" extensions="WorkOrdersInstaIPTemplateSharinPixImage"> <apex:form > <apex:pageBlock rendered="{! !hasNoImage}"> <apex:outputPanel style="overflow:hidden; height:100%"> <apex:pageBlockTable value="{!urlString}" var="title" > <apex:column style="vertical-align: top;"> <apex:facet name="header">Title</apex:facet> {!title} </apex:column> <apex:column > <apex:facet name="header">IP Template Images</apex:facet> <apex:panelGrid columns="5"> <apex:repeat value="{!urlString[title]}" var="img"> <table> <tr> <td> <figure style="margin-left: -0.5rem;"> <a href="javascript:void(0);" onclick="openImage('{! img.albumId }', '{! img.tokenString}')" > <img src="{!img.imageUrl}" height="150" width="160" alt="img not available" style= "display: block; padding-right: 0.5rem; padding-left: 0.5rem; padding-top: 1rem; margin:0" /> </a> <figCaption style='font-size: smaller;'> {! img.fileName } {! img.LandscapePortrait }</figCaption> </figure> </td> </tr> </table> </apex:repeat> </apex:panelGrid> </apex:column> </apex:pageBlockTable> </apex:outputPanel> </apex:pageBlock> <apex:outputPanel rendered="{!hasNoImage}"> <span style="background-color: #FFFFFF; font-size: 300%; height: 700px; width: 600px;"> <br/> No Image Found </span> </apex:outputPanel> </apex:form> <script> function openImage(albumId, tokenString){ window.open('https://app.sharinpix.com/pagelayout/'+albumId+'?fullscreen=false&token='+tokenString) } </script> <!-- <sharinpix:SharinPix parameters="{! parameters }" height="500px"></sharinpix:SharinPix> --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css"/> <style> .pbBody table.list tr.headerRow td, body .pbBody table.list tr.headerRow th { min-width: 5rem; } </style> </apex:page>
*******OUTPUT****************
- Mayur Shinde
- April 03, 2019
- Like
- 0
Hi Team pls tell me how to Optimize my test class and also bulkify please its very urgent
@isTest public class EventOrderController_Test { public static Id Order_recordTypeId1 =Schema.SObjectType.Order.getRecordTypeInfosByName().get('As Applied').getRecordTypeId(); public static testmethod void testAccountCreation() { Account acc=New Account(); acc.Name='C1-Ranch'; acc.Type='Procepect'; insert acc; Grower_Schedule__c gs=new Grower_Schedule__c(); gs.Schedule_Name__c='Vincent-Palmetto'; gs.Farming_Company__c=acc.Id; insert gs; Product2 prdRecd = new Product2(); prdRecd.Name='Test Product'; prdRecd .IsActive = true; prdRecd.ProductCode='prodcode'; insert prdRecd ; Event__c evn=new Event__c(); evn.Grower_Schedule__c =gs.Id; evn.of_REKS__c=1; evn.Products__c='test'; insert evn; // [Select Id,Name from Product2 where isActive =:true limit 1]; Id stdPb =Test.getStandardPricebookId(); //stdPb.isActive=true; //Id standardPriceBookId = stdPb.Id; PricebookEntry pbEntry = new PricebookEntry(); pbEntry.Product2Id = prdRecd.Id; pbEntry.Pricebook2Id = '01so0000002VkziAAC'; pbEntry.isActive=true; // pbEntry.currencyISOCode='USD'; pbEntry.UnitPrice =20; insert pbEntry; Event_Product__c evenprod = new Event_Product__c(); evenprod.Event__c= evn.Id; evenprod.Product__c =prdRecd.id; evenprod.Amount__c=10; evenprod.NOrder_Quantity__c=10; evenprod.Order_Quantity__c=5; insert evenprod; //evenprod.Grower_Schedule__c =gs.Id; order od=new order(); od.Status='Draft'; od.AccountId=acc.Id; od.Appointment_Time__c=System.today(); od.EffectiveDate=System.today(); od.RecordTypeId=Order_recordTypeId1; od.Acres__c=1; insert od; AssociatedSubPlot__c ASP=new AssociatedSubPlot__c(); //ASP.Name=Name.Id; ASP.Grower_Schedule__c=gs.Id; insert ASP; Soil_Sample__c soilSamplRecd = new Soil_Sample__c(); soilSamplRecd.Order__c=od.Id; // soilSamplRecd.Water_Source__c=WS.Id; insert soilSamplRecd; Associated_Sample_Zones__c ASZ= new Associated_Sample_Zones__c(); ASZ.Name='Test Mighty'; ASZ.Grower_Schedule__c=gs.Id; insert ASZ; Associated_Water_Sources__c AWS= new Associated_Water_Sources__c(); AWS.Name='Test Mighty'; AWS.Grower_Schedule__c=gs.Id; insert AWS; /*Water_Source__c WS =new Water_Source__c(); WS.Ranch__c=acc.Id; WS.Source_Name__c='Test'; WS.Type__c='Water Source - Well'; insert WS;*/ Test.StartTest(); ApexPages.StandardController sc = new ApexPages.StandardController(evn); PageReference pageRef = Page.EventOrder; // Add your VF page Name here pageRef.getParameters().put('id', String.valueOf(evn.Id)); Test.setCurrentPage(pageRef); EventOrderController testAccPlan = new EventOrderController(sc); /* PageReference pageRef1 = Page.EventOrder; // Add your VF page Name here pageRef1.getParameters().put('id', String.valueOf(od.RecordTypeId)); Test.setCurrentPage(pageRef1);*/ Integer NextRowNumber = 1; Integer addcount=1; EventOrderController.PaymentWrapper paywrap = new EventOrderController.PaymentWrapper(NextRowNumber,evenprod); EventOrderController.PlantWrapper plntwrap = new EventOrderController.PlantWrapper(NextRowNumber,ASZ); EventOrderController.WaterWrapper wtrwrap = new EventOrderController.WaterWrapper(NextRowNumber,AWS); EventOrderController.PIWrapper piwrap=new EventOrderController.PIWrapper(NextRowNumber,ASP); testAccPlan.save(); //call all your function here testAccPlan.getPicklistvalues(); testAccPlan.getWrappers(); testAccPlan.cancel(); testAccPlan.addRows(); testAccPlan.delWrapper(); testAccPlan.addPI(); testAccPlan.delPI(); testAccPlan.addPlant(); testAccPlan.delPlant(); testAccPlan.addWater(); testAccPlan.delWater(); testAccPlan.getPIWrappers(); testAccPlan.getPlantWrapper(); testAccPlan.getWaterWrapper(); testAccPlan.toDelIdent = 10; testAccPlan.toDelIdents = 5; testAccPlan.toDelIdentPlnt = 6; testAccPlan.toDelIdentWtr = 7; testAccPlan.eventPrdct = evenprod; Test.StopTest(); } public static testmethod void testAccountCreation2() { Account acc=New Account(); acc.Name='C1-Ranch'; acc.Type='Procepect'; insert acc; Grower_Schedule__c gs=new Grower_Schedule__c(); gs.Schedule_Name__c='Vincent-Palmetto'; gs.Farming_Company__c=acc.Id; insert gs; Product2 prdRecd = new Product2(); prdRecd.Name='Test Product'; prdRecd .IsActive = true; prdRecd.ProductCode='prodcode'; insert prdRecd ; Event__c evn=new Event__c(); evn.Grower_Schedule__c =gs.Id; evn.of_REKS__c=1; evn.Products__c='test'; insert evn; // [Select Id,Name from Product2 where isActive =:true limit 1]; Id stdPb =Test.getStandardPricebookId(); //stdPb.isActive=true; //Id standardPriceBookId = stdPb.Id; PricebookEntry pbEntry = new PricebookEntry(); pbEntry.Product2Id = prdRecd.Id; pbEntry.Pricebook2Id = '01so0000002VkziAAC'; pbEntry.isActive=true; // pbEntry.currencyISOCode='USD'; pbEntry.UnitPrice =20; insert pbEntry; order od=new order(); od.Status='Draft'; od.AccountId=acc.Id; od.Appointment_Time__c=System.today(); od.EffectiveDate=System.today(); od.RecordTypeId=Order_recordTypeId1; od.Acres__c=1; insert od; AssociatedSubPlot__c ASP=new AssociatedSubPlot__c(); //ASP.Name=Name.Id; ASP.Grower_Schedule__c=gs.Id; insert ASP; Soil_Sample__c soilSamplRecd = new Soil_Sample__c(); soilSamplRecd.Order__c=od.Id; // soilSamplRecd.Water_Source__c=WS.Id; insert soilSamplRecd; Associated_Sample_Zones__c ASZ= new Associated_Sample_Zones__c(); ASZ.Name='Test Mighty'; ASZ.Grower_Schedule__c=gs.Id; insert ASZ; /*Water_Source__c WS =new Water_Source__c(); WS.Ranch__c=acc.Id; WS.Source_Name__c='Test'; WS.Type__c='Water Source - Well'; insert WS;*/ Test.StartTest(); ApexPages.StandardController sc = new ApexPages.StandardController(evn); PageReference pageRef = Page.EventOrder; // Add your VF page Name here pageRef.getParameters().put('id', String.valueOf(evn.Id)); Test.setCurrentPage(pageRef); EventOrderController testAccPlan = new EventOrderController(sc); /* PageReference pageRef1 = Page.EventOrder; // Add your VF page Name here pageRef1.getParameters().put('id', String.valueOf(od.RecordTypeId)); Test.setCurrentPage(pageRef1);*/ Integer NextRowNumber = 1; Integer addcount=1; //EventOrderController.PaymentWrapper paywrap = new EventOrderController.PaymentWrapper(NextRowNumber,evenprod); EventOrderController.PlantWrapper plntwrap = new EventOrderController.PlantWrapper(NextRowNumber,ASZ); //EventOrderController.WaterWrapper wtrwrap = new EventOrderController.WaterWrapper(NextRowNumber,AWS); EventOrderController.PIWrapper piwrap=new EventOrderController.PIWrapper(NextRowNumber,ASP); testAccPlan.save(); //call all your function here testAccPlan.getPicklistvalues(); testAccPlan.getWrappers(); testAccPlan.cancel(); //testAccPlan.addRows(); testAccPlan.delWrapper(); testAccPlan.addPI(); testAccPlan.delPI(); testAccPlan.addPlant(); testAccPlan.delPlant(); testAccPlan.addWater(); testAccPlan.delWater(); testAccPlan.getPIWrappers(); testAccPlan.getPlantWrapper(); testAccPlan.getWaterWrapper(); testAccPlan.toDelIdent = 10; testAccPlan.toDelIdents = 5; testAccPlan.toDelIdentPlnt = 6; testAccPlan.toDelIdentWtr = 7; // testAccPlan.eventPrdct = evenprod; Test.StopTest(); } }above is my test class please help me.....
- Mayur Shinde
- February 12, 2018
- Like
- 0
How to create this requirement report:
Pls help me ane provide screenshot pls urgent..
Report issue..
Below requirement.
I want a report where all the account name must be listed which have opportunity not been created either in 30 or 60 or 90 days.
Report issue..
Below requirement.
I want a report where all the account name must be listed which have opportunity not been created either in 30 or 60 or 90 days.
- Mayur Shinde
- January 05, 2018
- Like
- 0
Hi team pls help me how to write this trigger.
Pls help me....
Use case
-On Opportunity object
- Create Fields FirstName,LastName,Email,Phone.
- Create checkbox 'create account & contact'.
-create contact lookup on opportunity.
- When opportunity record is saved, and the checkbox is set as true. Insert new Account & Contact and connect this opportunity with that Account & Contact.
- Only trigger event to take care of is Insert.
Trigger on opportutnity
pls any one help me n how to write in best practice....
Use case
-On Opportunity object
- Create Fields FirstName,LastName,Email,Phone.
- Create checkbox 'create account & contact'.
-create contact lookup on opportunity.
- When opportunity record is saved, and the checkbox is set as true. Insert new Account & Contact and connect this opportunity with that Account & Contact.
- Only trigger event to take care of is Insert.
Trigger on opportutnity
pls any one help me n how to write in best practice....
- Mayur Shinde
- November 23, 2017
- Like
- 0
Hello Team, I Want Write Trigger Could you pls Help Me how to write this Use Case Pls i am begginer..
Practice Use Case:
1.create a checkbox 'create contact' on Account.
2.create a trigger which handles events like account insert, update, delete.
3.Trigger will be responsible for creating contact with defined set of fields. It will be responsible to keep key information of contact updated from Account. Hence Account will still be treated as master for key information.
1.create a checkbox 'create contact' on Account.
2.create a trigger which handles events like account insert, update, delete.
3.Trigger will be responsible for creating contact with defined set of fields. It will be responsible to keep key information of contact updated from Account. Hence Account will still be treated as master for key information.
- Mayur Shinde
- November 07, 2017
- Like
- 0
HI Forum, I am facing same issue in VF page please help me out.
Hi,
-i want image placed in side by side but i will show vertically.
- requrement is simple:
- i want grand chaild of image URL field Show on Parent object.
IP(Parent Object) --> WO(Child Object) --- Grand Child(SI)
*******APEX controller***********************
public class WorkOrdersInstaIPTemplateSharinPixImage{ public List<IP_Template__c> IPTemplateLst {get;set;} public List<String> urlList {get;set;} public Map<String, List<ImageParam>> urlString{get;set;} public Boolean hasNoImage{set;get{ return urlString.size()==0?true:false; }} public WorkOrdersInstaIPTemplateSharinPixImage (ApexPages.StandardController stdCtrl) { Id workOrderId = stdCtrl.getId(); // Work order ID urlString= new Map<String, List<ImageParam>>(); Set <ID> installedProductSet= new Set <ID>(); // SET of Installed Product ID System.debug('Installed Product :' + installedProductSet); List<SVMXC__Service_Order__c> workOrderLSt = new List<SVMXC__Service_Order__c>(); //List Of Work Order workOrderLSt=[select Id,SVMXC__Component__c,IP_Template_Type__c from SVMXC__Service_Order__c where Id = :workOrderId AND IP_Template_Type__c !=NUll]; //Fetch the Wo related Installed Product for(SVMXC__Service_Order__c woInstall: workOrderLSt) { system.debug('woInstall.SVMXC__Component__c:- '+woInstall.SVMXC__Component__c); installedProductSet.add(woInstall.SVMXC__Component__c); system.debug('installedProductSet:- '+installedProductSet); } IPTemplateLst= [SELECT Id,Type__c,Installed_Product__c,Title__c, (Select Id, sharinpix__ImageURLFull__c,Landscape_Portrait__c,sharinpix__FileName__c, sharinpix__AlbumID__c FROM SharinPix_Images__r order by sharinpix__SortPosition__c ASC), (SELECT Id, sharinpix__SharinPix_Token__c FROM SharinPix_Albums__r) FROM IP_Template__c Where Installed_Product__c IN:installedProductSet AND Type__c!=Null ORDER BY Title__c ASC]; //Fetch the IP temate related to Installed Product urlList= new List<String>(); System.debug('IPTemplateLst :'+IPTemplateLst); List<IP_Template__c> IPTemplate = new List<IP_Template__c>(); For(IP_Template__c ip: IPTemplateLst) { For(SVMXC__Service_Order__c work:workOrderLSt) { if((ip.Installed_Product__c==work.SVMXC__Component__c)&& (ip.Type__c==work.IP_Template_Type__c )) { IPTemplate.add(ip); } } } for(IP_Template__c titleUrl:IPTemplateLst) { List<ImageParam> urlValues = new List<ImageParam>(); for(SVMXC__Service_Order__c work:workOrderLSt){ if((titleUrl.Installed_Product__c==work.SVMXC__Component__c)&& (titleUrl.Type__c==work.IP_Template_Type__c ) ) { for(sharinpix__SharinPixImage__c b: titleUrl.SharinPix_Images__r) { urlValues.add(new ImageParam(b, titleUrl.SharinPix_Albums__r[0].sharinpix__SharinPix_Token__c)); } urlString.put(titleUrl.Title__c, urlValues); } } } System.debug('urlString :'+urlString); } public class ImageParam{ public String imageUrl{set;get;} public String albumId{set;get;} public String tokenString{set;get;} public String LandscapePortrait{set;get;} public String fileName{set;get;} public ImageParam(sharinpix__SharinPixImage__c img, String tokenString){ this.imageUrl = img.sharinpix__ImageURLFull__c; this.albumId = img.sharinpix__AlbumID__c; this.LandscapePortrait = img.Landscape_Portrait__c; this.fileName = img.sharinpix__FileName__c; sharinpix.Client spClient = sharinpix.Client.getInstance(); Map<String, Object> params = new Map<String, Object> { 'album_id' => albumId, 'path' => '/pagelayout/'+albumId, 'exp' => (DateTime.now().getTime()/1000) + 300, 'Id' => albumId, 'abilities' => new Map<String, Object> { 'tags' => new Map<String, Object> { 'read' => true }, albumId => new Map<String, Object> { 'Access' => new Map<String, Object> { 'see' => true, 'image_list' => true, 'image_upload' => true, 'image_delete' => true, 'image_annotate' => true, 'image_tag' => true }, 'Display' => new Map<String, Object>{ 'see' => true, 'tags' => true, 'date' => 'L' } } } }; this.tokenString = spClient.token(params); } } }************* VF code***************
<apex:page standardController="SVMXC__Service_Order__c" extensions="WorkOrdersInstaIPTemplateSharinPixImage"> <apex:form > <apex:pageBlock rendered="{! !hasNoImage}"> <apex:outputPanel style="overflow:hidden; height:100%"> <apex:pageBlockTable value="{!urlString}" var="title" > <apex:column style="vertical-align: top;"> <apex:facet name="header">Title</apex:facet> {!title} </apex:column> <apex:column > <apex:facet name="header">IP Template Images</apex:facet> <apex:panelGrid columns="5"> <apex:repeat value="{!urlString[title]}" var="img"> <table> <tr> <td> <figure style="margin-left: -0.5rem;"> <a href="javascript:void(0);" onclick="openImage('{! img.albumId }', '{! img.tokenString}')" > <img src="{!img.imageUrl}" height="150" width="160" alt="img not available" style= "display: block; padding-right: 0.5rem; padding-left: 0.5rem; padding-top: 1rem; margin:0" /> </a> <figCaption style='font-size: smaller;'> {! img.fileName } {! img.LandscapePortrait }</figCaption> </figure> </td> </tr> </table> </apex:repeat> </apex:panelGrid> </apex:column> </apex:pageBlockTable> </apex:outputPanel> </apex:pageBlock> <apex:outputPanel rendered="{!hasNoImage}"> <span style="background-color: #FFFFFF; font-size: 300%; height: 700px; width: 600px;"> <br/> No Image Found </span> </apex:outputPanel> </apex:form> <script> function openImage(albumId, tokenString){ window.open('https://app.sharinpix.com/pagelayout/'+albumId+'?fullscreen=false&token='+tokenString) } </script> <!-- <sharinpix:SharinPix parameters="{! parameters }" height="500px"></sharinpix:SharinPix> --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css"/> <style> .pbBody table.list tr.headerRow td, body .pbBody table.list tr.headerRow th { min-width: 5rem; } </style> </apex:page>
*******OUTPUT****************
- Mayur Shinde
- April 03, 2019
- Like
- 0
Hello Team, I Want Write Trigger Could you pls Help Me how to write this Use Case Pls i am begginer..
Practice Use Case:
1.create a checkbox 'create contact' on Account.
2.create a trigger which handles events like account insert, update, delete.
3.Trigger will be responsible for creating contact with defined set of fields. It will be responsible to keep key information of contact updated from Account. Hence Account will still be treated as master for key information.
1.create a checkbox 'create contact' on Account.
2.create a trigger which handles events like account insert, update, delete.
3.Trigger will be responsible for creating contact with defined set of fields. It will be responsible to keep key information of contact updated from Account. Hence Account will still be treated as master for key information.
- Mayur Shinde
- November 07, 2017
- Like
- 0