How to run a custom script only once when a new item is created

Hi Everyone,

Is there any way that I can run a custom script only once after a new item code is generated in Item DocType.

Regards
Ruchin Sharma

@ruchin78

when you create new item_code add one condition in your custom_script
to check whether newly created item_code not in existing Item.
It run only once.
If you change something in Item and save condition fails.

@Sangram
Now the question is how to check that with using custom script only.

Regards
Ruchin Sharma

@ruchin78

with only custom_script
you can try -

   if(doc.__islocal){
	
	// your code
}