• Dru Rattigan 11
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
I have a trigger that I have created a test for, this gives me 100% coverage for the trigger but the test has an error System.AssertException: Assertion Failed
This is the trigger:
trigger AddUUID on Advertisement__c (before insert) {
    
    Uuid myUuid = new Uuid();
String myUuidValue = myUuid.getValue();
    
    for(Advertisement__c  acc:trigger.new){acc.UUID__c = myUuidValue;}

}

This is the test class:
@istest
public class TestAdvertisementUUID {
    @istest
    public static void testadvertisement(){
       Advertisement__c ADV = new Advertisement__c(Apprenticeship_Opportunity__c='0064L000009nWLaQAM');
        test.startTest();
        Database.SaveResult result = Database.insert(ADV,False);
        Test.stopTest();
        System.assert(!result.isSuccess());
    }
}

Any help as to what I'm doing wrong would be greatly appreciated
I have a visualforce page that renders without problem using an iframe to create the table. This was created by a colleague that no longer works with us. We have developed an issue when using the print button in that it no longer renders all items in the iframe repeat, only the first. 
rendered lists:User-added imageUser-added imageon click of print
User-added image
<apex:page lightningStylesheets="false" showHeader="false" standardController="Apprentice__c" >
 <style>
      @media print
      {    
      .no-print, .no-print *
      {
      display: none !important;
      }
      }
   </style>
   <apex:slds />

   <apex:form >
      <div class="no-print slds-align_absolute-center slds-m-top_small slds-m-bottom_medium">
         <apex:commandButton value="Print" Onclick="window.print();"/>
      </div>
      <div class="slds-grid slds-wrap slds-align_absolute-center slds-text-body_small slds-box">
         <div class="slds-col slds-small-size_1-of-3 slds-large-size_1-of-3">
            <B>
               <apex:outputText >Apprentice: </apex:outputText>
            </B>
            <br/>
            <span>
               <apex:outputtext value="{!Apprentice__c.Apprentice_name__c}" style="width:95%"/>
            </span>
         </div>
         <div class="slds-col slds-small-size_1-of-3 slds-large-size_1-of-3">
            <B>
               <apex:outputText >Employer: </apex:outputText>
            </B>
            <br/>
            <span>
               <apex:outputtext value="{!Apprentice__c.Employer_name__c}" style="width:95%"/>
            </span>
         </div>
         <div class="slds-col slds-small-size_1-of-3 slds-large-size_1-of-3">
            <B>
               <apex:outputText >Apprenticeship: </apex:outputText>
            </B>
            <br/>
            <span>
               <apex:outputtext value="{!Apprentice__c.Apprenticeship_Title__c}" style="width:95%"/>
            </span>
         </div>
      </div>
     <div class="slds-grid slds-wrap slds-text-body_small slds-box">
         <div class="slds-col slds-small-size_1-of-1 slds-large-size_1-of-1 slds-m-bottom_medium">
            <b>Skillscan Scoring Instructions:-</b>
         </div>
         <div class="slds-col slds-small-size_1-of-2 slds-large-size_1-of-2 slds-m-bottom_small">
            <B> 1 - Novice</B><br/>
         </div>
         <div class="slds-col slds-small-size_1-of-2 slds-large-size_1-of-2 slds-m-bottom_small">
            <B> 2 - Emerging</B><br/>
         </div>
         <div class="slds-col slds-small-size_1-of-2 slds-large-size_1-of-2 slds-m-bottom_small">
            <B> 3 - Developing.</B><br/>
         </div>
         <div class="slds-col slds-small-size_1-of-2 slds-large-size_1-of-2 slds-m-bottom_small">
            <B> 4 - Competent</B><br/>
         </div>
         <div class="slds-col slds-small-size_1-of-2 slds-large-size_1-of-2 slds-m-bottom_small">
            <B> 5 - Proficient</B><br/>
         </div>
         <div class="slds-col slds-small-size_1-of-2 slds-large-size_1-of-2 slds-m-bottom_small">
            <B> 6 - Expert</B><br/>
         </div>
      </div>
      <apex:repeat value="{!Apprentice__c.Apprentice_KSB__r}" var="SkillscanKSB">
         <iframe frameBorder="0" scrolling="no" height="200px" id="Hybrid_AppComponent_Details" name="Hybrid_AppComponent_Details" src="/apex/Skillscan_KSB_Details?id={!SkillscanKSB.Id}" width="100%"></iframe>
      </apex:repeat>
   </apex:form>
</apex:page>
Any advice as to why this has changed would be appreciated
 
I have setup a named credential and then imported an open API for an external service  (attached) which I linked to the named credential. I have then tested a few get calls from the open api calling the created apex classes in flow to set apex defined variables and all works fine.
 
I then try to use a post function to create an applicant record or try to create an applicant using the add import function again setting the variable in apex defined variables using flow. This time I get a an error see attached. From what I can tell the endpoint is being changed 
from:
https://webapps.pellcomp.net/BigCreativeAcademy/PICSRestService/Imports/ (https://webapps.pellcomp.net/BigCreativeAcademy/PICSRestService/Imports/" style="color:#015ba7; text-decoration:none)
to
https://webapps2.pellcomp.net/BigCreativeAcademy/PICSRestService/Imports/ (https://webapps2.pellcomp.net/BigCreativeAcademy/PICSRestService/Imports/" style="color:#015ba7; text-decoration:none)
the redirect is then not running.
 
Any ideas why this would happen? I have contacted both Salesforce and Pellcom support and neither can explain this to me.
 
I have a trigger that I have created a test for, this gives me 100% coverage for the trigger but the test has an error System.AssertException: Assertion Failed
This is the trigger:
trigger AddUUID on Advertisement__c (before insert) {
    
    Uuid myUuid = new Uuid();
String myUuidValue = myUuid.getValue();
    
    for(Advertisement__c  acc:trigger.new){acc.UUID__c = myUuidValue;}

}

This is the test class:
@istest
public class TestAdvertisementUUID {
    @istest
    public static void testadvertisement(){
       Advertisement__c ADV = new Advertisement__c(Apprenticeship_Opportunity__c='0064L000009nWLaQAM');
        test.startTest();
        Database.SaveResult result = Database.insert(ADV,False);
        Test.stopTest();
        System.assert(!result.isSuccess());
    }
}

Any help as to what I'm doing wrong would be greatly appreciated
I have setup a named credential and then imported an open API for an external service  (attached) which I linked to the named credential. I have then tested a few get calls from the open api calling the created apex classes in flow to set apex defined variables and all works fine.
 
I then try to use a post function to create an applicant record or try to create an applicant using the add import function again setting the variable in apex defined variables using flow. This time I get a an error see attached. From what I can tell the endpoint is being changed 
from:
https://webapps.pellcomp.net/BigCreativeAcademy/PICSRestService/Imports/ (https://webapps.pellcomp.net/BigCreativeAcademy/PICSRestService/Imports/" style="color:#015ba7; text-decoration:none)
to
https://webapps2.pellcomp.net/BigCreativeAcademy/PICSRestService/Imports/ (https://webapps2.pellcomp.net/BigCreativeAcademy/PICSRestService/Imports/" style="color:#015ba7; text-decoration:none)
the redirect is then not running.
 
Any ideas why this would happen? I have contacted both Salesforce and Pellcom support and neither can explain this to me.