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;


$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;

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

use Spipu\Html2Pdf\Html2Pdf;

require __DIR__ . '/html2pdf/vendor/autoload.php';

class LeadLogicHook {

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

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

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

function updateSelectedCourses(&$bean, $event, $arguments) {
   $getcc=" ***************************************My SQL is working good******************** ";
			$res=$bean->db->query($getcc, true);
			while ($row = $bean->db->fetchByAssoc($res)){

Please give me clue to solve my problem.