Unable to get field value first time from custom logichook

Hi Everyone,

I need help to solve my problem. I m using Suitecrm 7.8.8 version.

I add custom code to logichook file in the Leads module. I have custom fields which are photo_c to keep photo id and phototype_c to keep photo extensions of my records. These both fields are text type. I m using a php form to post my fields to db by using SOAP service. My uploads and fields are recorded succesfully to db. When i try to get these two fields from db, they are empty at first time, second time they are coming from db. I don’t know why, but my after_save function is working two times in my custom logichook file.
Is there any way to get these two fields at first time when my after_save function is working first time? Except these two fields, All other fields are coming good at first time.

Not: “deleteRelatedRecord” and “list_view_coloring” functions are working good.

My logic_hook file;

\custom\modules\Leads\logic_hooks.php

<?php
$hook_version = 1; 
$hook_array = Array(); 
// position, file, function 
$hook_array['before_delete'] = Array(); 
$hook_array['before_delete'][] = Array(1, 'LeadLogicHook', 'custom/modules/Leads/LeadLogicHook.php','LeadLogicHook', 'deleteRelatedRecord'); 
$hook_array['after_save'] = Array(); 
$hook_array['after_save'][] = Array(1, 'LeadLogicHook', 'custom/modules/Leads/LeadLogicHook.php','LeadLogicHook', 'updateSelectedCourses'); 
$hook_array['process_record'] = Array(); 
$hook_array['process_record'][] = array(1, 'LeadLogicHook', 'custom/modules/Leads/LeadLogicHook.php','LeadLogicHook', 'list_view_coloring'); 
?>

My custom logichook file;
\custom\modules\Leads\LeadLogicHook.php


<?php
ob_start();
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

use Spipu\Html2Pdf\Html2Pdf;

require __DIR__ . '/html2pdf/vendor/autoload.php';
require_once('data/SugarBean.php');
require_once('modules/Leads/Lead.php');

class LeadLogicHook {

/****************************Delete Related Records*****************************/

function deleteRelatedRecord(&$bean, $event, $arguments) {
 	if($event=='before_delete'){
		$delnotes="delete from notes where parent_id='".$bean->id."'";
		$bean->db->query($delnotes, true);
	}
}

/****************************Delete Related Records*****************************/

function updateSelectedCourses(&$bean, $event, $arguments) {
	
	if($event=='after_save'){
	
	$carr=array();
	$c=0;
	
   $getcc=" ***************************************My SQL is working good******************** ";
			
			$res=$bean->db->query($getcc, true);
			
			    $applydate="";
			    $formid="";
				$schooltypeupper="";
				$schooltype="";
				$birthdate="";
				$startdate="";
				$startdate2="";
				$enddate="";
				$enddate2="";
				$startdate2="";
				$enddate="";
				$enddate2="";
				$nationality="";
				$acadyear="";
				$photo="";
				$phototype="";
				.
                                .
                                .
			
			while ($row = $bean->db->fetchByAssoc($res)){
			 
			    $formid=$row['fomid_c'];
				$schooltypeupper=$row['schooltypeupper'];
				$schooltype=$row['schooltype'];
				$birthdate=$row['birthdate'];
				$startdate=$row['startdate'];
				$startdate2=$row['startdate2'];
				$enddate=$row['enddate'];
				$enddate2=$row['enddate2'];
				$nationality=$row['nationality_c'];
				$acadyear=$row['acadyear_c'];
				$photo=$row['photo_c'];
				$phototype=$row['phototype_c'];		
				$degree1=$row['degree1_c'];
				$degree2=$row['degree2_c'];
                                .
                                .
                                .


Please give me clue to solve my problem.

Regards,