function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ritik DwivediRitik Dwivedi 

I am unable save Apex class . The link of apex class is given below

https://trailhead.salesforce.com/en/content/learn/projects/workshop_mgmt/workshop_mgmt_apex
SwethaSwetha (Salesforce Developers) 
HI Ritik,
What is the error you are seeing? I tried to replicate the scenario in my org and could see "Error: Compile Error: Invalid type: WorkThanks at line 11 column 5"

We have a separate Trailhead team who can help you with these issues. So, can you please use the below link to reach out to them so that one of the Engineers will get in touch with you.
Support: https://trailhead.salesforce.com/en/help?support=home

Please mark this answer as best if it helps so that others facing same issue will find it useful.Thanks
Ritik DwivediRitik Dwivedi
Hi Swetha 
Below is given apex class in trailhead project 
project Name - Build an Automated Workshop Management System
Module name - Automate Post-Workshop Tasks with Invocable Apex
I am unable to save this class 



 
global without sharing class GiveWorkThanksAction {

  @InvocableMethod(label='Give a Thanks Badge')
  global static void giveWorkBadgeActionsBatch(List<GiveWorkThanksRequest> requests) {
    for(GiveWorkThanksRequest request: requests){
      giveWorkBadgeAction(request);
    }
  }

  public static void giveWorkBadgeAction(GiveWorkThanksRequest request) {
    WorkThanks newWorkThanks = new WorkThanks();
    newWorkThanks.GiverId = request.giverId;
    newWorkThanks.Message = request.thanksMessage;
    newWorkThanks.OwnerId = request.giverId;
    insert newWorkThanks;
    WorkBadge newWorkBadge = new WorkBadge();
    // newWorkBadge.DefinitionId should be set to the ID for the Competitor Badge within this Org
    WorkBadgeDefinition workBadgeDef = [SELECT Id,Name FROM WorkBadgeDefinition WHERE Name = :request.badgeName Limit 1];
    newWorkBadge.DefinitionId = workBadgeDef.Id;
    newWorkBadge.RecipientId = request.receiverId;
    newWorkBadge.SourceId = newWorkThanks.Id ;
    //newWorkBadge.GiverId = request.giverId;
    insert newWorkBadge;
    WorkThanksShare newWorkThanksShare = new WorkThanksShare();
    newWorkThanksShare.ParentId = newWorkThanks.Id ;
    newWorkThanksShare.UserOrGroupId = request.receiverId;
    newWorkThanksShare.AccessLevel = 'Edit';
    insert newWorkThanksShare;
    FeedItem post = new FeedItem();
    post.ParentId = request.receiverId;
    post.CreatedById = request.giverId;
    post.Body = request.thanksMessage;
    post.RelatedRecordId = newWorkThanks.Id ;
    post.Type = 'RypplePost';
    insert post;
  }

  global class GiveWorkThanksRequest {

    @InvocableVariable(label='Giver Id' required=true)
    global Id giverId;
    @InvocableVariable(label='Receiver Id' required=true)
    global Id receiverId;
    @InvocableVariable(label='Thanks Message' required=true)
    global String thanksMessage;
    @InvocableVariable(label='Badge Name' required=true)
    global String badgeName;
  }
}