• Christos Kolonis
  • NEWBIE
  • 30 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 28
    Replies
Hello!

I am building a visualforce page which is a form to create a record in a custom object. The form is like this:

User-added image
I need to allign next to recipient field two buttons, a search and a clear. I tried several things but i cannot make it. Any ideas? Thank you!!

My Visualforce Code:
<apex:form>

        
        <apex:pageBlock id="alladdr">
            <apex:pageblockSection >
                <apex:pageMessages />
            </apex:pageblockSection>
            <apex:pageBlockSection title="Information">
                <apex:outputField value="{!account.Name}" html-disabled="true"/>
                

                
                <apex:inputText value="{!searchContact}" label="Recipient" style="float:left" />
  
                <apex:commandButton value="{!$Label.el_Search}" action="{!searchContact}" reRender="contactSection"/> 

                <apex:commandButton value="{!$Label.el_Clear}" action="{!clearContactResults}" reRender="contactSection" />


                <apex:inputField value="{!bAccount.el__dd__c}"/>
                <apex:inputField value="{!bAccount.el_Email_Addresses__c}" />
                <apex:inputField value="{!bAccount.el_ddd__c}"/>
                <apex:inputField value="{!bAccount.el__dd__c}"/>
                <apex:inputField value="{!bAccount.el_ddd__c}"/>
                <apex:inputField value="{!bAccount.el_dd__c}"/>
                <apex:inputField value="{!bAccount.el_ddd__c}"/>
                <apex:inputField value="{!bAccount.el_ddd__c}"/>
                <apex:inputField value="{!bAccount.el_dd__c}"/>
                <apex:inputField value="{!bAccount.el_Active__c}"/> 
                 
            </apex:pageBlockSection>

 
Hello,

I have the below code where i need to use a for loop to iterate into the pConf list. I need to avoid using the soql queries ( pConfAttr , cProd ) any ideas of how could i avoid it? 

Thank you!
 
public list<String> getBasketEnergyInfo(){
        
        cscfga__Product_Basket__c pBask = [select id from cscfga__Product_Basket__c where Id =:pBasket.Id limit 1];
        
        list<cscfga__Product_Configuration__c> pConf = [select cscfga__Product_Basket__c from cscfga__Product_Configuration__c where cscfga__Product_Basket__c =: pBask.Id];
        
        list<cscfga__Attribute__c> pConfAttr = [select name, cscfga__Value__c, cscfga__Product_Configuration__c, cssecmp__attribute_type__c from cscfga__Attribute__c 
                                                where cscfga__Product_Configuration__c =: pConf[0].id
                                                AND cssecmp__attribute_type__c = 'Lookup'];
        }
        
        list<Id> priceItemId = new list<Id>();
        
        for(cscfga__Attribute__c confVal: pConfAttr){
            if(confVal.cscfga__Value__c != null){
                id lookup = confVal.cscfga__Value__c;
                
                String sObjName = lookup.getSObjectType().getDescribe().getName();
                if(sObjName == 'cspmb__Price_Item__c'){    
                    priceItemId.add(lookup); 
                }
            }
        }   
        system.debug(priceItemId);
        
        cspmb__Price_Item__c cProd = [select id, el_Product_Type__c, cspmb__Product_Definition_Name__c from cspmb__Price_Item__c where id =: priceItemId];
        list<String> productTypesInfo = new list<String>();
        String productType = cProd.el_Product_Type__c; //Current basket's Product Type (Residential or Business)
        String productEnergy = cProd.cspmb__Product_Definition_Name__c; //Current basket's Energy Type (Electricity or Gas)
        productTypesInfo.add(productType);
        productTypesInfo.add(productEnergy);
            
        
        return productTypesInfo;
        
    }

 
Hello,

I am trying to pass a value of a variable to my apex class controller but i get that error:

el_getCustomerInvoices.js:4 Uncaught (in promise) ReferenceError: LWC component's @wire target property or method threw an error during value provisioning. Original error:
[pagePos is not defined]

My js code is this:
 
@api recordId;
@api subscriptionfield=false;
@api fromDT;
@api toDT;
@api pagePos = 0;
...... 

WIRE:

 @wire(getInvoices,{customerId: '$recordId', fromDate: '$fromDT', toDate: '$toDT',meterNum: '$selectedmeter',subscriptionNUm: '$selectedname', PagePosition: '$pagePos'})

My Apex Controller:

@auraEnabled(cacheable=true)
public static List<el_invoices> getInvoices(id customerId, String fromDate, String toDate, String meterNum, String subscriptionNUm, Integer PagePosition){
....

i need to pass the pagePos to my apex. Any ideas?

Thank you!
Hello,

I have a LWC which includes in it's columns several fields which get their previewed data by an apex. Can i render those fields based on criteria? Now i am populating 2 fields (each one is populated based on criteria in apex) based on apex criteria. But can i hide the one that is left blank?
My js columns are these:
 
const columns = [
 { label: invoiceNum, fieldName: 'InvoiceNumber' , type:'text'},
{ label: invoicePer, fieldName: 'InvoicePeriod', type: 'text' },
{ label: invoiceType, fieldName: 'InvoiceType', type: 'text' },
{ label: invoiceTA, fieldName: 'InvoiceTotalAmount', type: 'number' },
{ label: relatedSrv, fieldName: 'RelatedServices', type: 'text' },
{ label: invoiceDt, fieldName: 'InvoiceDate', type: 'date' },
{ label: invoiceDDt, fieldName: 'InvoiceDueDate', type: 'date' },
.....

For example, can i hide the invoiceDDt if it's not populated?

Thank you!
Hello,

I need to create a rest api which calls an external system and gets some info which are viewed in a lightining web component. Till now, the number of records rendered was set by a for loop as above:
 
for(Integer i=0; i<3; i++){
            el_invoices dummyRecord = new el_invoices();
            dummyRecord.InvoiceNumber='0000000001'+string.valueOf(i);
            dummyRecord.InvoicePeriod='09-2020,10-2020';
            dummyRecord.InvoiceType='Clearing Bill';
            dummyRecord.InvoiceTotalAmount=100.00;
            dummyRecord.RelatedServices='Related Services';
....

However, now i need to render as many records as a custom setting indicates. I created a custom setting with a value of number but i don't know how to make it function through this way. Can anyone help?

Thank you!
Hello, 

I need to create a contract record when a triggering event is occured. In the bellow code i need to loop through subscription records  and create a record for each subscription. However the services object can also have many records which each is associated with one subscription. So for example i have two subscriptions and two services, how can i create two records? one for each? (the subscription and services are fields in the contract object). Here is a snippet of my code:
 
map<Id, csord__Order__c> orderMap = new map<Id, csord__Order__c>([select id, name, csordtelcoa__Opportunity__c, csordtelcoa__Opportunity__r.AccountId, csordtelcoa__Opportunity__r.Account.name from csord__Order__c where id in:orderIds]);
            
            map<Id, csord__Subscription__c> subsMap = new map<Id, csord__Subscription__c>([select id, name from csord__Subscription__c where id in: subsIds]);
            system.debug('The subscriptions are ' + subsMap);
            map<Id, csord__Service__c> servicesMap = new map<Id, csord__Service__c>([select id, name, csord__Subscription__c from csord__Service__c where id in: serviceIds AND csord__Subscription__c =: subsMap.values().id AND csord__Service__c = null]);
            system.debug('The services are ' + servicesMap);
            map<Id, OpportunityContactRole> oppRoleMap = new map<Id, OpportunityContactRole>([select id, OpportunityId, ContactId, isPrimary from OpportunityContactRole where OpportunityId =: orderMap.values().csordtelcoa__Opportunity__c AND isPrimary = true limit 1]);
            
            for(csord__Subscription__c sub: subsList){
                
                csconta__Contract__c contract = new csconta__Contract__c();
                contract.csconta__Contract_Name__c = orderMap.Values().csordtelcoa__Opportunity__r.Account.name + ' Contract';
                contract.csconta__Account__c = orderMap.Values().csordtelcoa__Opportunity__r.AccountId;
                contract.csconta__Valid_From__c = system.today();
                contract.csconta__Status__c = 'Open';
                contract.csconta__Contact__c = oppRoleMap.Values().ContactId;
                contract.csconta__Order__c = orderMap.values().id;
                for(Id servi: servicesMap.keySet()){
                contract.csconta__Service__c = servicesMap.get(servi.id).id;    
                }
                //contract.csconta__Service__c = servicesMap.values().id;
                contract.csconta__Subscription__c = sub.id;
                contrList.add(contract);
            }
            
            insert contrList;
            return contrList;

 
Hello, 
I need to pass the OpportunityContactRole (contact id) to a new record's field, which is a contact one. I created a map for the OpportunityContactRole and i am trying to pass that id, when i debug at the MAP i get the values but when i pass the contact id to the field i get the error of attempitng to de-reference a null object. Above is a snippet of my code:
 
map<Id, OpportunityContactRole> oppRoleMap = new map<Id, OpportunityContactRole>([select id, OpportunityId, ContactId, isPrimary from OpportunityContactRole where OpportunityId IN: oppId AND isPrimary = true limit 1]);
            	system.debug('The ROLE MAP IS' + oppRoleMap);//i get the values
                system.debug('RoleMap Values ' +oppRoleMap.values());//i get also the values
                //csconta__Contract__c contr = [select id, csconta__Account__r.id from csconta__Contract__c where csconta__Account__r.id =: opp1.accountId];
                
                for(opportunity opp: oppList){
                
                if(oppMap.containsKey(opp.id)){
                    system.debug('inside first if ' + oppMap.containsKey(opp.id));
                    
                if(opp.StageName == 'Closed Won'){
                    system.debug('IS CLOSED WON? ' +opp.StageName);
                    list<csconta__Contract__c> contrList = [select id, csconta__Account__r.id from csconta__Contract__c where csconta__Account__r.id =: opp.accountId];
                    
                    if(contrList.isEmpty()){
                   csconta__Contract__c contract = new csconta__Contract__c();
                  // contract.csconta__Contract_Name__c = 'Hello' +' Contract';
                   contract.csconta__Contract_Name__c = oppMap.get(opp.id).account.name + ' Contract';
                   contract.csconta__Account__c = opp.AccountId;
                   contract.csconta__Valid_From__c = system.today();
                   contract.csconta__Status__c = 'Open';
                   contract.csconta__Contact__c = oppRoleMap.get(opp.id).ContactId;// seems like its null
                        system.debug('The contact is '+ contract.csconta__Contact__c);
                   createcontrList.add(contract); 
                    }

What can i do to pass the contact id?
Hello, 

I need a trigger which will run when the Opportunity is in stage "X". I have a handler apex class which checks if the Opportunity is in this stage and if it is, gets the Opportunity's attachments and deletes them. This Stage is updated by another apex class and trigger from another custom object. So, if i select manually the stage it functions as it should but if the stage is updated by the apex, my new trigger is not running. I am using before insert trigger. Any thoughts??

Thank you!
Hello, 

I am trying to get the Attachments related to Opportunity but in my query no attachments are found. I used the above code:
 
opportunity opp = [select id, name from opportunity];

list<Attachment> attList = [select id, name from Attachment where ParentId = :opp.id];

This query doesn't return any records. However the Attachments exist in this related list.

User-added imageAny ideas of how to get those attachments?

Thank you.
Hello,

I use a visualforce page which by clicking on a select list within that page, jquery fills in some information also in that page. The problem is when i'm logged in asa partner community user, when i click on the select list and the jquery runs i get a visualforce page error: Error occurred while loading a Visualforce page. A static resource (jquery) is used which is public. As an administrator it functions as it should. Any ideas of how to fix it?

Thank you.
Hello,

I have a custom button which is type of URL. My URL is directing to a visualforce page. The behavior i chose is: Display in existing window without sidebar or header. However, still in my community page, it redirects me to another tab. Can i prevent this of happening? I need it in the same page.

Thank you.
Hello, 

I have a custom object which i also exposed it to community. The view of this object is a visualforce. In its related list there are attachments which as an administrator i can view but as a partner i cannot. I get the error: 

Looks like there's a problem.
This record isn't supported. See your administrator for help.

How can i give the access to my partner user? 

Thank you!
Hello, 

I need to compare two date fields, the End Date of an event created inside an Opportunity and the today date. Based on the outcome, i will update an Opportunity Stage.

I tried this unsuccessfully:
 
Event eve = [select id, subject, whatId, EndDate from Event where whatId =: newOpp.id];
                date d = eve.EndDate;
                system.debug(d);
                
                date e = system.today();
                system.debug(e);
                
                boolean dates = d.isSameDay(e);
                system.debug('Dates: ' + dates);




if(newOpp.RecordTypeId == recordTypeServices && dates == false && newOpp.StageName == 'Proposal'){
                   newOpp.addError('The appointment with the customer must be completed'); 
                }

That is not working. Am i missing something?

Thank you!
Hello, 

I have a visualforce page which i provide access through the Community. I can access the visualforce page within the Community page. The steps are:

1) View the Visualforce page
2) Press a button which opens up a new visualforce page
3) Press the finish button to redirect me back to the previous page (i get an error of site down for maintenance)

In the console i get this error:

GET https://mysiteurl 503 (Service Unavailable)

This functionality is working on inside the Salesforce. Any ideas about how to fix it?
Thank you!
Hello, 

i want to get the value of the confList to the guaranteeSOQL but i get the error: Variable does not exist: Replaced_Configuration__r
how can i overcome this?
 
list<Configuration__c> confList = [select id, name, Basket__r.id, Basket__r.Account__r.id, Replaced_Configuration__r.id  from Configuration__c where Basket__r.id = : basketId];
           
Guarantee__c guaranteeSOQL = [select id, name, g_Configuration__r.id from Guarantee__c where g_Configuration__r.id =: confList.Replaced_Configuration__r.id];

Thank you.
I need to retrieve the Account id and insert it to my method. Get the Basket__r.Account__r.id and place it to the Account id inside the for loop. How can i do that?
 
list<Configuration__c> conf = [select id, name, Basket__r.id, Basket__r.Account__r.id  from Configuration__c where Basket__r.id = : basketId];
    
    
    for (Configuration__c confList: conf){
    
    Attachment att = [select id, body from Attachment where name like parentId = :confList.id];
    system.debug(att);
    system.debug(att.Body);
    system.debug(att.Body.toString()); 
    list <Guarantee_Line__c> guara = new list <Guarantee_Line__c>();
    
    guara = GuaranteeCreator.createGuarantee(att.Body.toString(), confList, Account id);
    }

 
Hello, 

I need to create records based on a JSON. The problem right now is that the key value of the JSON contains white spaces, so the deserialization comes with null values. How can i deal with that? 
 
public class GuaranteeJSON {
    
    public List<Configurations> configurations;
    
    public class Configurations {
		public String guid;
		public String Guarantee Type;
		public String Guarantee Amount;
		public String In Advance Amount;   
}
    public static GuaranteeJSON parse(String json) {
		return (GuaranteeJSON) System.JSON.deserialize(json, GuaranteeJSON.class);
	}
}

 
Hello,

I have a custom button which is type of URL. My URL is directing to a visualforce page. The behavior i chose is: Display in existing window without sidebar or header. However, still in my community page, it redirects me to another tab. Can i prevent this of happening? I need it in the same page.

Thank you.
Hello!

I am building a visualforce page which is a form to create a record in a custom object. The form is like this:

User-added image
I need to allign next to recipient field two buttons, a search and a clear. I tried several things but i cannot make it. Any ideas? Thank you!!

My Visualforce Code:
<apex:form>

        
        <apex:pageBlock id="alladdr">
            <apex:pageblockSection >
                <apex:pageMessages />
            </apex:pageblockSection>
            <apex:pageBlockSection title="Information">
                <apex:outputField value="{!account.Name}" html-disabled="true"/>
                

                
                <apex:inputText value="{!searchContact}" label="Recipient" style="float:left" />
  
                <apex:commandButton value="{!$Label.el_Search}" action="{!searchContact}" reRender="contactSection"/> 

                <apex:commandButton value="{!$Label.el_Clear}" action="{!clearContactResults}" reRender="contactSection" />


                <apex:inputField value="{!bAccount.el__dd__c}"/>
                <apex:inputField value="{!bAccount.el_Email_Addresses__c}" />
                <apex:inputField value="{!bAccount.el_ddd__c}"/>
                <apex:inputField value="{!bAccount.el__dd__c}"/>
                <apex:inputField value="{!bAccount.el_ddd__c}"/>
                <apex:inputField value="{!bAccount.el_dd__c}"/>
                <apex:inputField value="{!bAccount.el_ddd__c}"/>
                <apex:inputField value="{!bAccount.el_ddd__c}"/>
                <apex:inputField value="{!bAccount.el_dd__c}"/>
                <apex:inputField value="{!bAccount.el_Active__c}"/> 
                 
            </apex:pageBlockSection>

 
Hello,

I have the below code where i need to use a for loop to iterate into the pConf list. I need to avoid using the soql queries ( pConfAttr , cProd ) any ideas of how could i avoid it? 

Thank you!
 
public list<String> getBasketEnergyInfo(){
        
        cscfga__Product_Basket__c pBask = [select id from cscfga__Product_Basket__c where Id =:pBasket.Id limit 1];
        
        list<cscfga__Product_Configuration__c> pConf = [select cscfga__Product_Basket__c from cscfga__Product_Configuration__c where cscfga__Product_Basket__c =: pBask.Id];
        
        list<cscfga__Attribute__c> pConfAttr = [select name, cscfga__Value__c, cscfga__Product_Configuration__c, cssecmp__attribute_type__c from cscfga__Attribute__c 
                                                where cscfga__Product_Configuration__c =: pConf[0].id
                                                AND cssecmp__attribute_type__c = 'Lookup'];
        }
        
        list<Id> priceItemId = new list<Id>();
        
        for(cscfga__Attribute__c confVal: pConfAttr){
            if(confVal.cscfga__Value__c != null){
                id lookup = confVal.cscfga__Value__c;
                
                String sObjName = lookup.getSObjectType().getDescribe().getName();
                if(sObjName == 'cspmb__Price_Item__c'){    
                    priceItemId.add(lookup); 
                }
            }
        }   
        system.debug(priceItemId);
        
        cspmb__Price_Item__c cProd = [select id, el_Product_Type__c, cspmb__Product_Definition_Name__c from cspmb__Price_Item__c where id =: priceItemId];
        list<String> productTypesInfo = new list<String>();
        String productType = cProd.el_Product_Type__c; //Current basket's Product Type (Residential or Business)
        String productEnergy = cProd.cspmb__Product_Definition_Name__c; //Current basket's Energy Type (Electricity or Gas)
        productTypesInfo.add(productType);
        productTypesInfo.add(productEnergy);
            
        
        return productTypesInfo;
        
    }

 
Hello,

I have a LWC which includes in it's columns several fields which get their previewed data by an apex. Can i render those fields based on criteria? Now i am populating 2 fields (each one is populated based on criteria in apex) based on apex criteria. But can i hide the one that is left blank?
My js columns are these:
 
const columns = [
 { label: invoiceNum, fieldName: 'InvoiceNumber' , type:'text'},
{ label: invoicePer, fieldName: 'InvoicePeriod', type: 'text' },
{ label: invoiceType, fieldName: 'InvoiceType', type: 'text' },
{ label: invoiceTA, fieldName: 'InvoiceTotalAmount', type: 'number' },
{ label: relatedSrv, fieldName: 'RelatedServices', type: 'text' },
{ label: invoiceDt, fieldName: 'InvoiceDate', type: 'date' },
{ label: invoiceDDt, fieldName: 'InvoiceDueDate', type: 'date' },
.....

For example, can i hide the invoiceDDt if it's not populated?

Thank you!
Hello,

I need to create a rest api which calls an external system and gets some info which are viewed in a lightining web component. Till now, the number of records rendered was set by a for loop as above:
 
for(Integer i=0; i<3; i++){
            el_invoices dummyRecord = new el_invoices();
            dummyRecord.InvoiceNumber='0000000001'+string.valueOf(i);
            dummyRecord.InvoicePeriod='09-2020,10-2020';
            dummyRecord.InvoiceType='Clearing Bill';
            dummyRecord.InvoiceTotalAmount=100.00;
            dummyRecord.RelatedServices='Related Services';
....

However, now i need to render as many records as a custom setting indicates. I created a custom setting with a value of number but i don't know how to make it function through this way. Can anyone help?

Thank you!
Hello, 

I need a trigger which will run when the Opportunity is in stage "X". I have a handler apex class which checks if the Opportunity is in this stage and if it is, gets the Opportunity's attachments and deletes them. This Stage is updated by another apex class and trigger from another custom object. So, if i select manually the stage it functions as it should but if the stage is updated by the apex, my new trigger is not running. I am using before insert trigger. Any thoughts??

Thank you!
Hello, 

I am trying to get the Attachments related to Opportunity but in my query no attachments are found. I used the above code:
 
opportunity opp = [select id, name from opportunity];

list<Attachment> attList = [select id, name from Attachment where ParentId = :opp.id];

This query doesn't return any records. However the Attachments exist in this related list.

User-added imageAny ideas of how to get those attachments?

Thank you.
Hello,

I use a visualforce page which by clicking on a select list within that page, jquery fills in some information also in that page. The problem is when i'm logged in asa partner community user, when i click on the select list and the jquery runs i get a visualforce page error: Error occurred while loading a Visualforce page. A static resource (jquery) is used which is public. As an administrator it functions as it should. Any ideas of how to fix it?

Thank you.
Hello, 

I have a custom object which i also exposed it to community. The view of this object is a visualforce. In its related list there are attachments which as an administrator i can view but as a partner i cannot. I get the error: 

Looks like there's a problem.
This record isn't supported. See your administrator for help.

How can i give the access to my partner user? 

Thank you!
Hello, 

I need to compare two date fields, the End Date of an event created inside an Opportunity and the today date. Based on the outcome, i will update an Opportunity Stage.

I tried this unsuccessfully:
 
Event eve = [select id, subject, whatId, EndDate from Event where whatId =: newOpp.id];
                date d = eve.EndDate;
                system.debug(d);
                
                date e = system.today();
                system.debug(e);
                
                boolean dates = d.isSameDay(e);
                system.debug('Dates: ' + dates);




if(newOpp.RecordTypeId == recordTypeServices && dates == false && newOpp.StageName == 'Proposal'){
                   newOpp.addError('The appointment with the customer must be completed'); 
                }

That is not working. Am i missing something?

Thank you!
Hello, 

I have a visualforce page which i provide access through the Community. I can access the visualforce page within the Community page. The steps are:

1) View the Visualforce page
2) Press a button which opens up a new visualforce page
3) Press the finish button to redirect me back to the previous page (i get an error of site down for maintenance)

In the console i get this error:

GET https://mysiteurl 503 (Service Unavailable)

This functionality is working on inside the Salesforce. Any ideas about how to fix it?
Thank you!
I need to retrieve the Account id and insert it to my method. Get the Basket__r.Account__r.id and place it to the Account id inside the for loop. How can i do that?
 
list<Configuration__c> conf = [select id, name, Basket__r.id, Basket__r.Account__r.id  from Configuration__c where Basket__r.id = : basketId];
    
    
    for (Configuration__c confList: conf){
    
    Attachment att = [select id, body from Attachment where name like parentId = :confList.id];
    system.debug(att);
    system.debug(att.Body);
    system.debug(att.Body.toString()); 
    list <Guarantee_Line__c> guara = new list <Guarantee_Line__c>();
    
    guara = GuaranteeCreator.createGuarantee(att.Body.toString(), confList, Account id);
    }

 
Hello, 

I need to create records based on a JSON. The problem right now is that the key value of the JSON contains white spaces, so the deserialization comes with null values. How can i deal with that? 
 
public class GuaranteeJSON {
    
    public List<Configurations> configurations;
    
    public class Configurations {
		public String guid;
		public String Guarantee Type;
		public String Guarantee Amount;
		public String In Advance Amount;   
}
    public static GuaranteeJSON parse(String json) {
		return (GuaranteeJSON) System.JSON.deserialize(json, GuaranteeJSON.class);
	}
}