• Akis Athanasiadis
  • NEWBIE
  • 85 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 44
    Replies
I have created a screen flow which is used to override the edit button using lightning component.
The debug of the flow does not conclude to any errors.

However, when  I go via the original object itself I do receive error.
"Update Fee
The flow couldn't find the "Get_Maintenance_Fee" resource."

The lightning component code:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,lightning:actionOverride" access="global" >
	<aura:handler name="init" value="{!this}" action="{!c.init}" />
    <lightning:flow aura:id="flowId" />
</aura:component>

controller:
({
    init : function (component) {
        // Find the component whose aura:id is "flowId"
        var flow = component.find("flowId");
        // In that component, start your flow. Reference the flow's Unique Name.
        flow.startFlow("Update_Fee");
    }
})

​​​​​​​
 
I have created a lightning component that executes a screen flow which is running on "New".
How can I customize the layout of the lightning component?
For example, i want to have 2 columns and set specific fields insise these columns.
I have created a flow and a lightning component which run on new.
The flow creates a record and I want at the end of the flow to be redicted inside the record which was  just created.
In the flow I store the new record's id as {!recordId}

The controller is:
 
({
    init : function (component) {
        // Find the component whose aura:id is "flowId"
        var flow = component.find("flowId");
        // In that component, start your flow. Reference the flow's Unique Name.
        flow.startFlow("Internal_Requests");
        
    },
handleStatusChange : function (component, event) {
    
    if(event.getParam("status") === "FINISHED") {
       var navEvt = $A.get("e.force:navigateToSObject");
            navEvt.setParams({
                "recordId": "??????????",
                "slideDevName": "related"
            });
            navEvt.fire();
         }
      },
})


What do i set at the record Id though to be redicted in the new record?

All the threads I have found, provide specific Id which of course does not apply to our needs.

How can i Delete apex class/trigger from production?
I have found several articles but they are 8-9 years old and what is described is not helpful.
Hello,

I have the contract standard object which has several record types.
in case i have the record type vendor purchases the user will need to insert another contract code. So contract standard obejct has a look up field to itself.
I would like in case i have the record type vendor-purchases, when i insert the contract code it is related with, to automatically insert the Account id.
This is what i've dove done but i get error " A non foreign key field cannot be referenced in a path expression: Maintenance_Contract__c at line 8 column 27"
trigger Vendor on Contract (before insert,before update) {
    
    for (Contract c : Trigger.new)
    {
        
        if (c.RecordTypeId=='0120Q0000004gQO')
        {
            c.AccountId=c.Maintenance_Contract__c.AccountID;
        }
        
        
    }
}

An example of the layout
User-added image
I have created a visualforce page when a new case is created.
When i assign the VF page to the new button of case, the community users cannot see the new button.
I have checked in VF page creation the box "Available for Lightning Experience, Lightning Communities, and the mobile app"
Hello,

I have created a trigger which is supposed to create multiple records.
 
trigger CreateMultipleContacts on Contract  (after insert,  after update) {
    
    List<Contract_Renewal__c> contractFinalListToInsert = New List<Contract_Renewal__c>();
    
    if(Trigger.isInsert || Trigger.isUpdate){
        for(Contract  c : Trigger.New) {
            if(c.Renew__c == true) {
                Integer fetchingAlreadyExistedRecords = [SELECT count() FROM Contract_Renewal__c WHERE Contract__c=:c.Id and Not_Renewed__c=:false and Multi_Year__c=:true];
                
                if(fetchingAlreadyExistedRecords!=null) {
                    // We are only creating a records when there at least one Contract record exists.
                    for(Integer i=0; i<fetchingAlreadyExistedRecords; i++) {
                        Contract_Renewal__c con = new Contract_Renewal__c();
                        con.Contract__c = c.Id;
                        contractFinalListToInsert.add(con);
                        
                    }
                }
            }
            
            try{
                if(!contractFinalListToInsert.IsEmpty()){
                    INSERT contractFinalListToInsert;
                }
            }
            catch(Exception e){
                System.debug('The thrown exception for CreatingAutoRecords is:: ' + e.getMessage());
            }
        }
    }
}
I have the Contracts object and the Contract Renewals which is related to Contracts(Contracts master object)
When i check the box renew in contracts, records of contract renewal which are its children are created. However, when i do that no records are created. I check the contract renewals object just in case records arecreated without being assigned to the contracts. any ideas of what might be missing here?

when i
I have an object named Contract_Renewals__c which is related to Contracts (Master Detail)
Contracts are also related (sipmle lookup) with Contract_Renewals__c.
In contracts I have a checkbox named Renew__c.
What i want is if the Renew__c=True then to create new records of Contract Renewals.
If i have 5 contract renewals, then 5 should be created.
Any help please?
I want to create a process that will behave as the master detail relationship.
I cannot use the master detail relationship though due to operational reasons.
I have the Maintenance_Fees__c object which automatically creates a Contract_Renewal__c record. In the Contract_Renewal__c I have created a lookup field towards the Maintenance_Fees__c.
So what I need is whenever a maintenance fee is deleted, if there is a contract renewal record which is connected to this maintenance fee, then this record should also be deleted.
I have created a visualforce page for contracts on create using the following code.
 
<apex:page standardController="Contract"  title="New Contract" >
    
    <apex:sectionHeader subtitle="New Contract"/>
    <apex:form >
        <apex:pageBlock mode="edit">
            <apex:pageMessages />
            <apex:pageBlockButtons location="top">
                 
                <apex:commandButton value="Save" action="{!save}"/>
                
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
           
                 <apex:pageBlockSection title="Information"  columns="2">
                     
               <apex:pageblocksection columns="1">
                
                
                <!--<apex:inputField value="{!currentRecord.id}"  required="false" />-->
                <apex:inputField value="{!Contract.Account}"  required="true" />
                <apex:inputField value="{!Contract.End_Customer__c}"  required="false" />
                <apex:inputField value="{!Contract.Automatic_Renewal__c}"  required="false" />
                <apex:inputField value="{!Contract.Annual_Adjustment_Percentage__c}"  required="false" />
                <apex:inputField value="{!Contract.Vendor__c}"  required="false" />
                <apex:inputField value="{!Contract.Vat__c}"  required="true" />
                
                </apex:pageblocksection> 
                 
                <apex:pageblocksection columns="1">
                <apex:inputField value="{!Contract.Account_Executive__c}"  required="true" />
                <apex:inputField value="{!Contract.Renewal_Type__c}"  required="true" />
                <apex:inputField value="{!Contract.Payment_Terms__c}"  required="true" />
                <apex:inputField value="{!Contract.Invoice_Period__c}"  required="true" />
                <apex:inputField value="{!Contract.StartDate}"  required="false" />
                   
               </apex:pageblocksection> 
                 
               
               
            </apex:pageBlockSection>
            
            <apex:pageBlockButtons location="bottom">
                 
                <apex:commandButton value="Save" action="{!save}"/>
                
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
           
        </apex:pageBlock>
        
        
       

    </apex:form>
    
    
</apex:page>

I have assigned the VF page to the new button.
When I try to create a new contract I receive the following error message.

User-added image
When I comment the account field, the process is moving on.
Any ideas on how to resolve this?
I have an object named Maintenance Fees which is a child to Contracts and to Product Assignment. its related list is only under Product Assignment.
This object has also a record type.
I have created a custom button which reads the record types and proceeds to the next page having both Product Assignment and Contracts  lookup fields already filled in. The issue is when I save the record that I go to the home page instead of returning to the maintenance fee record that was just created.
The code that I used is this:

 
https://cs109.salesforce.com/setup/ui/recordtypeselect.jsp?ent=01I0Q0000008y23&retURL=%2F{!Contract.Id}&save_new_url=%2Fa0i%2Fe%3FCF00N0Q000000dqIP%3D{!Asset_Product_Association__c.Contract__c}%26CF00N0Q000000dqIP_lkid%3D{!Contract.Id}%26saveURL%3D%252F{!Contract.Id}%26retURL&CF00N0Q000000dqIU={!Asset_Product_Association__c.Product__c}&CF00N0Q000000dqIP={!Contract.Id}&saveURL=%2F{!Contract.Id}&saveURL={!Contract.Id}

Any Ideas?
I have a custom object named "Internal Assets" which has several related lists.
There is a pick list field in Internal Assets which conditionally creates a related list.
The picklist values are the following:
User-added image
When the desktop option is selected, a record is created in the related list.
However, I don't want to see all the related lists below:
User-added image
I would like to see only the related list which is related to the picklist item that is selected.
I believe that might happen using visualforce page. However, I am not sure how to set the conditional code (if exists) for that.
Any ideas?
Hi there,
I have an approval process and I need when the process is approved to create automatically a new record.
I have checked several threads abou similar issues and everyone is telling this can be done with PB.
I had already done this but it doesn't fire automatically.
I have a checkbox named renewed  in the renewals object where the process gets  approved. This field is checked automatically when the process is approved. The new record doensn't get created. It gets created only if I edit+save the renewals records.
Any ideas on how to do that automatically?
Hi,

I am trying to create a trigger which will be checking a checkbox automatically when another process is done.
In specific, I have a custom object Vacation Requests which follows an approval process. If the request is approved, a checkbox "Approved" is being checked.
Then I am creating a trigger which needs to check if the current date is = to the start date of the vacation. if yes, then the checkbox should be selected.
However this doesn't happen.
Any ideas?
trigger Vacation on Vacation_Requests__c (before insert) {
    User u = new User();
    for (Vacation_Requests__c vr:Trigger.new) {
        if (vr.Approved__c==true && vr.Start_Date__c==System.Today()) 
            u.On_Vacation__c=true;        
    }

}

 
I need to remove the logo from the community login page.
User-added image
I have tried to .communityLogo { visibility:hidden} in branding section but the image is not hidden.
Any ideas?
Hi,

I need to send every day to the employees an email(reminder) to fill in yesterday's events in calendar.
I have used this code but it didn't work.
global class sendEmailToUSer implements Schedulable {
    global void execute(SchedulableContext sc) {
        list<User> lstUser = [Select ID from User where isActive = true and Name='Athanasiadis, Akis'];
        for(User iterator : lstUser) {
            EmailTemplate objTemp = [SELECT Id FROM EmailTemplate where DeveloperName = 'Case status for Contacts' limit 1];
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            mail.setTemplateId(objTemp.Id);
            mail.setTargetObjectId(iterator.Id);
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
        }
    }
}
I received the following error:
Scheduler: failed to execute scheduled job: jobId: 7077E00000oGr5L, class: common.apex.async.AsyncApexJobObject, reason: List has no rows for assignment to SObject

I firstly wanted to check it on myself in order to make sure if this works.
Any help?
Is there any way to have a scheduled report to be stored in a specific local path?
Ex...let's say I have a scheduled report for monday. is there any way to have it exported and stored in excel in a specific local folder ?
I need to have a schedule report exported to excel and put it into a schedule and  send it to specific e-mails.
I have already the report created.

I have used the following code:

global class Exporter implements System.Schedulable {
    global void execute(SchedulableContext sc) {
        ApexPages.PageReference report = new ApexPages.PageReference('/00O58000003m3Sa?csv=1');
        Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
        attachment.setFileName('report.xls');
        attachment.setBody(report.getContent());
        attachment.setContentType('text/csv');
        Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
        message.setFileAttachments(new Messaging.EmailFileAttachment[] { attachment } );
        message.setSubject('Report');
        message.setPlainTextBody('The report is attached.');
        message.setToAddresses( new String[] { 'mplampla.com' } );
        Messaging.sendEmail( new Messaging.SingleEmailMessage[] { message } );
        
    }
 }

although I don't see how i give this a schedule.
I guess that this reads the schedule that exists in the report and so the report is sent thourgh this code as an attachment in an email?
Can I also store the executable attachment directly to a path?
I have created a visualforce page in order to create the activities tab.
I found through the "create new view" in calendar the ID:
https://cs84.salesforce.com/ui/list/FilterEditPage?ftype=z&retURL=%2F007%3Ffcf%3D00B58000004YXWq%26rolodexIndex%3D-1%26page%3D1

and I created the page by using this code:
<apex:page > 
    <apex:enhancedList listId="3D00B58000004YXW" height="600" customizable="false" rowsPerPage="25"/> 
</apex:page>

Nevertheless, I receive a "bad filter id" message when I try to access the new tab

Hello.

I have a question.I need to create an auto delete process throuch process builder.

I have a custom object "revenues" and a custom object "purchases".Every time i add,create or delete a revenue a record from purchases must be created/updated/deleted.As for now I have accomplished the creation and update process but I cannot find a way to auto delete a purchase record when the relative revenue record is deleted.Can you give me some help with this?

I have created a screen flow which is used to override the edit button using lightning component.
The debug of the flow does not conclude to any errors.

However, when  I go via the original object itself I do receive error.
"Update Fee
The flow couldn't find the "Get_Maintenance_Fee" resource."

The lightning component code:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,lightning:actionOverride" access="global" >
	<aura:handler name="init" value="{!this}" action="{!c.init}" />
    <lightning:flow aura:id="flowId" />
</aura:component>

controller:
({
    init : function (component) {
        // Find the component whose aura:id is "flowId"
        var flow = component.find("flowId");
        // In that component, start your flow. Reference the flow's Unique Name.
        flow.startFlow("Update_Fee");
    }
})

​​​​​​​
 
I have created a lightning component that executes a screen flow which is running on "New".
How can I customize the layout of the lightning component?
For example, i want to have 2 columns and set specific fields insise these columns.
I have created a flow and a lightning component which run on new.
The flow creates a record and I want at the end of the flow to be redicted inside the record which was  just created.
In the flow I store the new record's id as {!recordId}

The controller is:
 
({
    init : function (component) {
        // Find the component whose aura:id is "flowId"
        var flow = component.find("flowId");
        // In that component, start your flow. Reference the flow's Unique Name.
        flow.startFlow("Internal_Requests");
        
    },
handleStatusChange : function (component, event) {
    
    if(event.getParam("status") === "FINISHED") {
       var navEvt = $A.get("e.force:navigateToSObject");
            navEvt.setParams({
                "recordId": "??????????",
                "slideDevName": "related"
            });
            navEvt.fire();
         }
      },
})


What do i set at the record Id though to be redicted in the new record?

All the threads I have found, provide specific Id which of course does not apply to our needs.

How can i Delete apex class/trigger from production?
I have found several articles but they are 8-9 years old and what is described is not helpful.
Hello,

I have the contract standard object which has several record types.
in case i have the record type vendor purchases the user will need to insert another contract code. So contract standard obejct has a look up field to itself.
I would like in case i have the record type vendor-purchases, when i insert the contract code it is related with, to automatically insert the Account id.
This is what i've dove done but i get error " A non foreign key field cannot be referenced in a path expression: Maintenance_Contract__c at line 8 column 27"
trigger Vendor on Contract (before insert,before update) {
    
    for (Contract c : Trigger.new)
    {
        
        if (c.RecordTypeId=='0120Q0000004gQO')
        {
            c.AccountId=c.Maintenance_Contract__c.AccountID;
        }
        
        
    }
}

An example of the layout
User-added image